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


C++ Level::drawGameGround方法代码示例

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


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

示例1: drawSunMask

void Camera::drawSunMask(GOIterator* gameObjects, BgObjectContainer* bgObjects, Level& level)
{
	


	sunIt->object->draw(this, &FBO1);

	float particleId = 0.0f;

	BgOIterator* front = 0;
	for (BgOIterator* it = sunIt->next; it; it = it->next)
	{
		while(particleManager->getDepth(this, particleId) > it->object->getDepth() && particleId < particleManager->getSize())
		{
			particleManager->draw(this, &FBO1, particleId);
			particleId++;
		}

		if (it->object->getDepth() < 1.0f)
		{
			front = it;
			break;
		}
		it->object->draw(this, &FBO1, sf::Color::Black);



	}
	
	level.drawGameGround(this, &FBO1, false, sf::Color::Black);


	while(particleManager->getDepth(this, particleId) > 1.0f && particleId < particleManager->getSize())
	{
		particleManager->draw(this, &FBO1, particleId);
		particleId++;
	}


	//for (GOIterator* it = gameObjects; it; it = it->next)
	//{
	//	it->object->draw(this, &FBO1, false);
	//}

	if (front)
	{
		for (BgOIterator* it = front; it; it = it->next)
		{
			it->object->draw(this, &FBO1, sf::Color::Black);
		}

	}

}
开发者ID:janoldsen,项目名称:Time-Bubble,代码行数:54,代码来源:Camera.cpp

示例2: draw

void Camera::draw(GOIterator* gameObjects, BgObjectContainer* bgObjects, Level& level, bool debug)
{

	FBO1.setView(view);
	//FBO2.setView(view);

	depthShader.setParameter("time", gameClock->getTotalElapsedTime());

	particleManager->sort();


	if (sunIt)
	{
		FBO1.clear(sf::Color::Transparent);
		drawSunMask(gameObjects, bgObjects, level);
		
		sf::Vector2f sunPos = (sf::Vector2f)FBO1.mapCoordsToPixel(sunIt->object->getSprite().getPosition());

		sunPos.x /= FBO1.getSize().x;
		sunPos.y /= FBO1.getSize().y;

		sunPos.y = 1.0f - sunPos.y;

		sunShader.setParameter("sun_pos", sunPos);
		sunShader.setParameter("weight", sunStrength);

		FBO1.display();

		FBO2.clear(sf::Color::Transparent);
		FBO2.draw(sf::Sprite(FBO1.getTexture()), &sunShader);
		FBO2.display();

	}


	FBO1.clear();

	

	int particleId = 0;

	level.drawBackGround(this, &FBO1, debug);
	
	BgOIterator* front = 0;
	sunIt = 0;
	for (BgOIterator* it = bgObjects->begin; it; it = it->next)
	{

		while(particleManager->getDepth(this, particleId) > it->object->getDepth() && particleId < particleManager->getSize())
		{
			particleManager->draw(this, &FBO1, particleId);
			particleId++;
		}

		if (it->object->getDepth() < 1.0f)
		{
			front = it;
			break;
		}
		it->object->draw(this, &FBO1);

			

		if (it->object->getName() == "sun")
			sunIt = it;

	}

	
	
	level.drawGameGround(this, &FBO1, debug);

	while(particleManager->getDepth(this, particleId) > 1.0f && particleId < particleManager->getSize())
	{
		particleManager->draw(this, &FBO1, particleId);
		particleId++;
	}


	
	for (GOIterator* it = gameObjects; it; it = it->next)
	{
		it->object->draw(this, &FBO1, debug);
	}



	if (sunIt)
	{
		FBO1.setView(FBO1.getDefaultView());
		FBO1.draw(sf::Sprite(FBO2.getTexture()), sf::BlendAdd);
		FBO1.setView(view);
	}

	
	
	FBO1.display();

	FBO2.draw(sf::Sprite(FBO1.getTexture()));

//.........这里部分代码省略.........
开发者ID:janoldsen,项目名称:Time-Bubble,代码行数:101,代码来源:Camera.cpp


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