本文整理汇总了C++中sf::RenderTarget::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ RenderTarget::Clear方法的具体用法?C++ RenderTarget::Clear怎么用?C++ RenderTarget::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sf::RenderTarget
的用法示例。
在下文中一共展示了RenderTarget::Clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void GameScene::draw(sf::RenderTarget& target)
{
target.Clear(sf::Color(255,255,255));
sf::Vector2f cam_topleft = view().GetCenter() - view().GetHalfSize();
sf::Vector2f cam_bounds = view().GetHalfSize() * 2.0f;
sf::Vector2f bgtile(
background_->transformed_width(),
background_->transformed_height());
for (int j = -1; j <= cam_bounds.y/bgtile.y + 1; j++)
{
for (int i = -1; i <= cam_bounds.x/bgtile.x + 1; i++)
{
sf::Vector2f tilepos(cam_topleft);
tilepos.x /= bgtile.x;
tilepos.y /= bgtile.y;
tilepos.x = std::floor(tilepos.x) * bgtile.x;
tilepos.y = std::floor(tilepos.y) * bgtile.y;
tilepos.x += i * bgtile.x;
tilepos.y += j * bgtile.y;
background_->set_position(tilepos);
background_->draw(target);
}
}
for (Entity* d : decorations_)
{
d->draw(target);
}
for (Effect* e : effects_)
{
e->draw(target);
}
for (Entity* p : platforms_)
{
p->draw(target);
}
for (Entity* g : goalflags_)
{
g->draw(target);
}
for (Entity* c : collectibles_)
{
c->draw(target);
}
player_.draw(target);
}
示例2: 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);
}