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); }
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); }