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


C++ RenderTarget::Draw方法代码示例

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


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

示例1: Render

void RenderQueue::Render( sf::RenderTarget& target, sf::Renderer& /*renderer*/ ) const {
	if( !m_display_list ) {
		// Display list couldn't be created, render normally.

		std::size_t children_size = m_children.size();

		for( DrawablesVector::size_type index = 0; index < children_size; ++index ) {
			target.Draw( *( m_children[index].first ) );
		}
	}
	else if( !m_display_list_compiled ) {
		glNewList( m_display_list, GL_COMPILE_AND_EXECUTE );

		std::size_t children_size = m_children.size();

		for( DrawablesVector::size_type index = 0; index < children_size; ++index ) {
			target.Draw( *( m_children[index].first ) );
		}

		glEndList();

		m_display_list_compiled = true;
	}
	else {
		glCallList( m_display_list );
	}
}
开发者ID:Zykr,项目名称:SFGUI,代码行数:27,代码来源:RenderQueue.cpp

示例2: Render

void Car::Render(sf::RenderTarget & target) const
{
	target.Draw(sprite);

	//Draw the people stepping out of the elevator.
	Person *p = NULL;
	if (state == kHauling && (p = nextPassengerToUnmount())) {
		Sprite s;
		s.SetImage(app->bitmaps["simtower/elevator/people"]);
		s.SetCenter(direction == Elevator::kUp ? -elevator->shaft.GetSize().x : 16, 24);

		//Calculate the texture subrect for the person stepping out of the car.
		int type = p->type;
		sf::IntRect sr;
		sr.Left   = type * 32;
		sr.Right  = sr.Left + 16;
		sr.Top    = 24;
		sr.Bottom = 48;
		if (direction == Elevator::kUp) {
			sr.Left  += 16;
			sr.Right += 16;
		}
		
		//Draw the person.
		s.SetColor(sf::Color::Black);
		s.SetSubRect(sr);
		s.SetPosition(elevator->shaft.GetPosition().x, sprite.GetPosition().y);
		target.Draw(s);
	}
}
开发者ID:Hmaal,项目名称:OpenSkyscraper,代码行数:30,代码来源:Car.cpp

示例3: Render

void Zone::Render(sf::RenderTarget& target) const
{
	// affichage des tiles
	target.Draw(tiles_sprite_);

	// affichage des tiles animées
	for (std::vector<Tileset::AnimatedTile>::const_iterator it = animated_.begin();
		it != animated_.end(); ++it)
	{
		target.Draw(it->sprite);
	}

	// affichage des items
	ItemList::const_iterator it2;
	for (it2 = items_.begin(); it2 != items_.end(); ++it2)
	{
		target.Draw(**it2);
	}

	// affichage des entités
	entities_.sort(Entity::PtrComp);
	EntityList::const_iterator it;
	for (it = entities_.begin(); it != entities_.end(); ++it)
	{
		target.Draw(**it);
	}
}
开发者ID:charafsalmi,项目名称:ppd-paris-descartes,代码行数:27,代码来源:Zone.cpp

示例4: Render

    void Console::Render(sf::RenderTarget& target) const
    {
        Panel::Render(target);
        for(unsigned int i = 0; i < strings.size(); i++)
            target.Draw((strings.at(i)));

        target.Draw(*inStr);
    }
开发者ID:Liag,项目名称:shmup-base-engine,代码行数:8,代码来源:console.cpp

示例5: draw

void Menu::draw(sf::RenderTarget& window) const
{
    window.Draw(myBackground);
    window.Draw(myTitle);

    for(std::vector<Button>::const_iterator i = myButtons.begin(); i != myButtons.end(); ++i)
        i->draw(window);
}
开发者ID:flair2005,项目名称:multimodal-space-shooter,代码行数:8,代码来源:Menu.cpp

示例6: renderChars

void PlayerHUD::renderChars(sf::RenderTarget& targ) const {
	glPushMatrix();

	//Draw the globe and portrait in the correct place.
	targ.Draw(*mCharGlobe);

	glTranslatef(mCharGlobe->GetPosition().x, mCharGlobe->GetPosition().y, 0);
	glTranslatef(16, -14, 0);
	targ.Draw(*mCharThumb);
	glPopMatrix();
}
开发者ID:TokyoBirdy,项目名称:MasterOfSorcery,代码行数:11,代码来源:Player.cpp

示例7: Render

	void MenuBehaviour::Render(sf::RenderTarget& target, float interpolation)
	{
		sf::Sprite background = m_resources.Get(Sprite_Background);
		target.Draw(background);

		auto title = m_resources.GetText("Ulderico - Alpha");
		title.SetPosition(Game::WINDOW_WIDTH / 2 - title.GetGlobalBounds().Width / 2, 40.0f);
		target.Draw(title);
		
		for (auto item = m_menuItems.begin(); item != m_menuItems.end(); ++item)
			target.Draw(*item);
	}
开发者ID:fabian-paus,项目名称:ulderico-alpha,代码行数:12,代码来源:MenuBehaviour.cpp

示例8: Render

void Menu::Render(sf::RenderTarget& target) const
{
	if(m_confirmingAction)
	{
		target.Draw(*m_yesButton);
		target.Draw(*m_noButton);
	}
	
	for(int i = 0; i < m_buttons.size(); i++)
	{
		target.Draw(*m_buttons[i]);
	}

	target.Draw(*m_resumeButton);
}
开发者ID:larsendt,项目名称:tiny-world-jetpack-edition,代码行数:15,代码来源:Menu.cpp

示例9: draw

void Animation::draw(sf::RenderTarget& target)
{
    if (!hidden())
    {
        target.Draw(sprite_);
    }
}
开发者ID:nlguillemot,项目名称:rock-n-roll-soul,代码行数:7,代码来源:animation.cpp

示例10: Render

    void Receiver::Render(sf::RenderTarget& Target) const
    {
        float particleRatio = Helper::Clamp((float)receivedParticles / maximumParticles, 0.0f, 1.0f);

        sprite.SetColor(Helper::Blend(colorStart, colorEnd, particleRatio));
        Target.Draw(sprite);
    }
开发者ID:speps,项目名称:attractouch,代码行数:7,代码来源:receiver.cpp

示例11: draw

void Zombie::draw(sf::RenderTarget& target)
{
    b2Vec2 pos = m_body->GetPosition();
    m_sprite.SetPosition(pos.x * m_scene->getMeterPixelRatio(), pos.y * m_scene->getMeterPixelRatio());
    
    target.Draw(m_sprite);
}
开发者ID:Rubenknex,项目名称:Afterlife,代码行数:7,代码来源:Zombie.cpp

示例12: draw

void FightScene::draw(sf::RenderTarget &target)
{
    target.Clear();
    background2Anim->draw(target);

    target.Draw(behindBar1);
    target.Draw(behindBar2);

    target.Draw(p1bar);
    target.Draw(p2bar);

    target.Draw(p1refreshbar);
    target.Draw(p2refreshbar);


}
开发者ID:nlguillemot,项目名称:tsukino,代码行数:16,代码来源:fightscene.cpp

示例13: DrawField

void GS_Game::DrawField(sf::RenderTarget& renderTarget)
{
	for(int i = 0; i < 20; ++i)
	{
		for(int j = 0; j < 16; ++j)
		{
			if(_field[i].stack[j] > 0) 
			{
				float x = 200.0f + j * BLOCKSIZE;
				float y = 50.0f + i * BLOCKSIZE;
				_blockSprite.SetPosition(x, y);
				int entry = _field[i].colors[j];
				sf::Uint8 alpha = 255;
				if(_field[i].remFlag == true)
				{
					alpha = static_cast<int>(255.0f * sin(_blendTimer));
				}
				sf::Color color(colorTable[entry][0], colorTable[entry][1], 
					colorTable[entry][2], alpha);
				_blockSprite.SetColor(color);
				renderTarget.Draw(_blockSprite);
			}
		}
	}
}
开发者ID:plainoldcj,项目名称:fallin_brix,代码行数:25,代码来源:gs_game.cpp

示例14: Draw

// Draws all Entities to RenderTarget
void World::Draw(sf::RenderTarget& target, float blocksize, sf::Vector2f offset){
    // Iterate through all Entities and Draw their Sprites
    for ( EntityMap::iterator i = mEntities.begin(); i!=mEntities.end(); ++i ){
        sf::Sprite& s = i->second->GetSprite(blocksize, offset);
        target.Draw(s);
    }
}
开发者ID:timesqueezer,项目名称:OpenFala,代码行数:8,代码来源:World.cpp

示例15: Render

void BitmapString::Render(sf::RenderTarget& target) const
{
	for (SpriteVec::const_iterator it = bitmaps_.begin(); it != bitmaps_.end(); ++it)
	{
		target.Draw(*it);
	}
}
开发者ID:charafsalmi,项目名称:ppd-paris-descartes,代码行数:7,代码来源:BitmapString.cpp


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