本文整理汇总了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 );
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例9: draw
void Animation::draw(sf::RenderTarget& target)
{
if (!hidden())
{
target.Draw(sprite_);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
}
}
示例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);
}
}
示例15: Render
void BitmapString::Render(sf::RenderTarget& target) const
{
for (SpriteVec::const_iterator it = bitmaps_.begin(); it != bitmaps_.end(); ++it)
{
target.Draw(*it);
}
}