void plot_row(RenderWindow& win, CA const& ca, int iy) { int const width = 4; int const height = 4; Vector2f p1(0, 0); Vector2f p2(0, 0); for (int ix = 0; ix < ca.size(); ++ix) { p1.x = (ix + 1) * width; p1.y = (iy + 1) * height + 10; p2.x = p1.x + width; p2.y = p1.y - height; if (ca.at(ix)) { win.Draw(Shape::Rectangle(p1, p2, Color::Red, 1, Color::Black)); } else { win.Draw(Shape::Rectangle(p1, p2, Color::White, 1, Color::Black)); } } }
void Pildora::mover(float t, RenderWindow &w) { sp.SetSubRect(IntRect(0,0,45,48)); w.Draw(sp); tiempo_caida += t; if(pos.x > -30) { float velocidad, desplazamiento; velocidad = 2 - 1.5 * tiempo_caida; desplazamiento = (velocidad*velocidad + (1.5*2)) * 1.5/2; float direccion = pow(-2,rand()%4); sp.Move(-desplazamiento,rand()%2); pos = sp.GetPosition(); if (sp.GetPosition().y > 420){ impactado = true; sp.SetSubRect(IntRect(45,0,119,48)); w.Draw(sp); estado = false; } if (sp.GetPosition().y < 80) { sp.SetSubRect(IntRect(45,0,119,48)); impactado = true; w.Draw(sp); estado = false; } } else { sp.SetSubRect(IntRect(45,0,119,48)); w.Draw(sp); estado = false; impactado = true; } }
void HUD::Draw(RenderWindow& window){ window.Draw(*menuHUD); window.Draw(*nivel); barravida->Draw(window, 0.f); soundButton->Draw(window); musicButton->Draw(window); window.Draw(*clock); window.Draw(*coins); }
void TJBoutonSprite::Afficher(RenderWindow &App) { if (m_spriteChangement == true) { if(estDessusSouris(App)) { if(m_spriteNormal == true) { m_spriteNormal = false; chargerSprite2(); App.Draw(m_sprite); App.Draw(m_texteObjet); return; } else { App.Draw(m_sprite); App.Draw(m_texteObjet); return; } } else { if(m_spriteNormal == true) { App.Draw(m_sprite); App.Draw(m_texteObjet); return; } else { m_spriteNormal = true; chargerSprite(); App.Draw(m_sprite); App.Draw(m_texteObjet); return; } } } else { App.Draw(m_sprite); App.Draw(m_texteObjet); } }
void TileMap::draw(RenderWindow &Window) { int firstLineToDraw, lastLineToDraw, firstColumnToDraw, lastColumnToDraw, temp; const Vector2f& ViewCenter = Window.GetView().GetCenter(); firstLineToDraw = ((ViewCenter.y - (WINDOW_HEIGHT/2)) / TILE_USED_HEIGHT); lastLineToDraw = firstLineToDraw + (WINDOW_HEIGHT / TILE_USED_HEIGHT) + 2; firstColumnToDraw = ((ViewCenter.x - (WINDOW_WIDTH/2)) / TILE_WIDTH); lastColumnToDraw = firstColumnToDraw + (WINDOW_WIDTH / TILE_WIDTH) + 1; if(firstLineToDraw < 0) firstLineToDraw = 0; if(lastLineToDraw > (Tiles.size()-1)) lastLineToDraw = Tiles.size()-1; if(firstColumnToDraw < 0) firstColumnToDraw = 0; if(lastColumnToDraw > Tiles[0].size() -1) lastColumnToDraw = Tiles[0].size() -1; for(int j=firstLineToDraw; j<=lastLineToDraw; j++) { for(int i=firstColumnToDraw; i<=lastColumnToDraw; i++) { temp = Tiles[j][i]; Sprite_.SetPosition(i*TILE_WIDTH, (j*TILE_USED_HEIGHT) - TILE_UNUSED_HEIGHT); if(TileSet[temp].Image_ != NULL) Sprite_.SetImage(*(TileSet[temp].Image_)); Window.Draw(Sprite_); } } }
void Player::render(RenderWindow& rw) const { rw.Draw(*mDirectionSprite); PureEntity::render(rw); static sf::Shape rect = sf::Shape::Rectangle(0,0,32, 54, sf::Color(30, 150, 30, 150)); /*rect.SetPosition(collision_origin.Left, collision_origin.Top);*/ //rw.Draw(rect); }
void Draw(RenderWindow & App) { if(OwnCursor && ShowCursor) { CursorSprite.SetPosition(Position); App.Draw(CursorSprite); } }
void Draw(RenderWindow & App) { Shape1.SetPosition(App.ConvertCoords((int)Position.x, (int)Position.y)); Shape2.SetPosition(App.ConvertCoords((int)Position.x, (int)Position.y)); App.Draw(Shape2); App.Draw(Shape1); Shape1 = Shape::Rectangle(Position, Vector2f(Position.x + Size.x * (*Number / MaxNumber), Position.y + Size.y), Color1); }
static VALUE RenderWindow_draw(VALUE vSelf, VALUE vObject) { if(!ISKO(vObject, g_cDrawable)) rb_raise(rb_eTypeError, "wrong argument type(s)"); // Get C++ object pointer from vSelf RenderWindow *pSelf; Data_Get_Struct(vSelf, RenderWindow, pSelf); Drawable *pObject; Data_Get_Struct(vObject, Drawable, pObject); pSelf->Draw(*pObject); return Qnil; }
//---------------------------------------------------------------------------- void GraphicsRoot::Draw() { std::map<std::string, RenderWindowPtr>::iterator it = mRenderWindows.begin(); for (; it != mRenderWindows.end(); it++) { RenderWindow *rw = it->second; if (rw) { rw->ComputeVisibleSet(); rw->Draw(); } } }
void Rectangle(RenderWindow & App) { if(Left.Pressed) Pos1 = Position; if(Left.Hold) RectangleShape = Shape::Rectangle(Pos1,Position,Col2,1,Col1); if(Right.Hold) RectangleShape = Shape::Rectangle(Pos1,Position,Col2,1,Col1); if(Left.Hold || Keep) App.Draw(RectangleShape); }
//fonction d'affichage comme un sprite normal void animation::afficher(RenderWindow &fenAffichage) { updateSprite(); fenAffichage.Draw(spriteCourant); }
void Grasa::dibujar(RenderWindow &w) { w.Draw(sp); }
void TJBouton::Afficher(RenderWindow &App) { App.Draw(m_bouton); App.Draw(m_texteObjet); }
void Animation::draw(RenderWindow &app) { app.Draw(sprite); }
bool OptionsMenu::Run(RenderWindow &App, Son &son) { //On charge les volumes des musiques et des sons ChargerMusique(); ChargerSon(); //On change les textes des boutons ChangerTexteMusique(); ChangerTexteSon(); bool quit = false; // Tant que quit est égal à 'false' while (!quit) { if (App.IsOpened()) { // Gestion des évènements Event event; while (App.GetEvent(event)) { switch (event.Type) { case Event::KeyPressed: // Touche Clavier : { switch (event.Key.Code) { case Key::Escape: // Echap { quit = true; son.JouerSonBouton(); } break; case Key::F5: // F5 { CaptureEcran(App); } break; default: break; } } break; default: break; } } if(m_bouton1.isClicked(App)) { son.SetVolume(m_volumeSon); son.JouerSonBouton(); sf::Sleep(0.5); return true; } if(m_bouton_musique_moins.isClicked(App)) { DiminuerMusique(); //On baisse la musique de 1 sf::Sleep(0.1);//On endort le programme pour ralentir le défilement des chiffres quand le bouton est cliqué en boucle } if(m_bouton_musique_plus.isClicked(App)) { AugmenterMusique(); //On augmente la musique de 1 sf::Sleep(0.1);//On endort le programme pour ralentir le défilement des chiffres quand le bouton est cliqué en boucle } if(m_bouton_son_moins.isClicked(App)) { DiminuerSon(son); //On baisse le son de 1 sf::Sleep(0.1);//On endort le programme pour ralentir le défilement des chiffres quand le bouton est cliqué en boucle } if(m_bouton_son_plus.isClicked(App)) { AugmenterSon(son); //On augmente le son de 1 sf::Sleep(0.1);//On endort le programme pour ralentir le défilement des chiffres quand le bouton est cliqué en boucle } // Affichages // Remplissage de l'écran en couleur noir App.Clear(); m_bouton1.Afficher(App); m_bouton_controles.Afficher(App); m_bouton_musique.Afficher(App); m_bouton_musique_moins.Afficher(App); m_bouton_musique_plus.Afficher(App); m_bouton_son.Afficher(App); m_bouton_son_moins.Afficher(App); m_bouton_son_plus.Afficher(App); App.Draw(m_titre.GetSprite()); App.Display(); } } return false;//Si on arrive ici c'est que quit = true }
void Draw(RenderWindow & Target) { Target.Draw(sprite[index]); }
void Pildora::dibujar(RenderWindow &w) { w.Draw(sp); }
void EngineGraphic::Draw(RenderWindow &App, config &configuration, vector<Player>& Players, vector< vector<Enemy> >& Enemies) { fondSprite.SetImage(MyImageManager.getImage(configuration.fontSprite)); fondSprite.SetPosition(0,0); App.Draw(fondSprite); //dessine missiles for(int i=0;i<Players.size();i++) { for(int j=0;j<Players.at(i).getNumberOfMissiles();j++) { tempSprite.SetImage(MyImageManager.getImage(Players.at(i).getMissile(j).getType())); tempSprite.SetPosition(Players.at(i).getMissile(j).getCoord().x, Players.at(i).getMissile(j).getCoord().y); App.Draw(tempSprite); } } //dessine players for(int i=0;i<Players.size();i++) { tempSprite.SetImage(MyImageManager.getImage(configuration.playerSprite)); tempSprite.SetPosition(Players.at(i).getCoord().x, Players.at(i).getCoord().y); App.Draw(tempSprite); } //dessine enemies for(int i=0;i<Enemies.size();i++) { for(int j=0;j<Enemies.at(i).size();j++) { if(Enemies.at(i).at(j).estVivant()) { tempSprite.SetImage(MyImageManager.getImage(configuration.enemiesSprite)); tempSprite.SetPosition(Enemies.at(i).at(j).getCoord().x, Enemies.at(i).at(j).getCoord().y); App.Draw(tempSprite); } } } /* int debug = 0; for(int i=0;i<Enemies.size();i++) { for(int j=0;j<Enemies.at(i).size();j++) { if(Enemies[i][j].estVivant()) { debug++; } } }*/ //Affichage menu droite if(true) { stringstream temp; temp << "Vie(s) = "; temp << Players.at(0).getLife(); display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(16.f); display.SetPosition(LARGEUR_FENETRE+5,20); App.Draw(display); } if(true) { stringstream temp; temp << "Vague n° "; temp << configuration.vagueActuelle; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,60); App.Draw(display); } if(true) { stringstream temp; temp << "Nb de Vagues : "; temp << configuration.nombreDeVagues; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,80); App.Draw(display); } if(true) { int debug = Players.at(0).getMaxMissiles() - Players.at(0).getNumberOfMissiles(); stringstream temp; temp << "Tirs restants : "; temp << debug; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,110); App.Draw(display); } if(true) { int debug = configuration.score; stringstream temp; temp << "Score : "; temp << debug; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,140); App.Draw(display); } if(true) { int debug = configuration.pointsBonus; stringstream temp; temp << "Bonus : "; temp << debug; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,170); App.Draw(display); } if(true) { double pourcentage = 0; if(configuration.nombreDeTirsReussis>0 || configuration.nombreDeTirsRates>0) { pourcentage = (100*configuration.nombreDeTirsReussis)/(configuration.nombreDeTirsReussis+configuration.nombreDeTirsRates); } int debug=(int)pourcentage; stringstream temp; temp << "Précision : "; temp << debug; temp << " %"; display.SetText(temp.str()); display.SetColor(sf::Color::Red); display.SetSize(14.f); display.SetPosition(LARGEUR_FENETRE+5,200); App.Draw(display); } }
int Game::Run(RenderWindow &win, VideoMode &vMode) { Music m; SoundBuffer playerShootBuffer; SoundBuffer meteorBuffer; meteorBuffer.LoadFromFile("..\\Resources\\meteorexplosion.ogg"); playerShootBuffer.LoadFromFile("..\\Resources\\playerShoot.ogg"); Sound playerSound; Sound meteorSound; meteorSound.SetBuffer(meteorBuffer); playerSound.SetBuffer(playerShootBuffer); playerSound.SetLoop(false); meteorSound.SetLoop(false); m.OpenFromFile("..\\Resources\\asteroid.ogg"); m.SetLoop(true); m.SetVolume(100); PlayerShip ship(player_ship, 2, vMode); EnemyShip enemy(enemy_ship, vMode); Collision col; Event events; Image bg1; Image bg2; Image bg3; bg1.LoadFromFile("..\\Resources\\bg.jpg"); Image stars; string abc = "..\\Resources\\star.png"; stars.LoadFromFile(abc); Sprite sp(bg1); Sprite sp2(bg1); Sprite sp3(bg1); Sprite spStar[10]; Clock clock; srand((unsigned)time(0)); for(int i = 0; i<10; i++) { spStar[i].SetImage(stars); //spStar[i].SetPosition } spStar[0].SetPosition(0,100); spStar[1].SetPosition(70,200); spStar[2].SetPosition(200,300); spStar[3].SetPosition(320,400); spStar[4].SetPosition(460,500); spStar[5].SetPosition(260,300); spStar[6].SetPosition(160,400); spStar[7].SetPosition(400,200); spStar[8].SetPosition(760,100); spStar[9].SetPosition(800,600); int lowestx, highestx, lowesty, highesty, rangex, rangey, random_integerx, random_integery; float time1 = 0; float time2 = 0; bool start = false; //Sprite spStar1(stars); //spStar1.SetPosition(spStar.GetPosition().x, spStar.GetPosition().y - spStar.GetSize().y); sp.Resize((float)vMode.Width, (float)vMode.Height); sp2.Resize((float)vMode.Width, (float)vMode.Height); sp2.SetPosition(sp.GetPosition().x, sp.GetPosition().y - sp.GetSize().y); sp3.SetPosition(sp2.GetPosition().x, sp2.GetPosition().y - sp2.GetSize().y); //spStar.Resize((float)vMode.Width, (float)vMode.Height); bool key = false; bool down = false; Bullet *bul; Meteor* met[METEORCOUNT]; for(int i = 0; i<METEORCOUNT; i++) { met[i] = new Meteor(meteor, vMode); } met[0]->SetPosition(200,-400); met[1]->SetPosition(420,-200); met[2]->SetPosition(720,-400); met[3]->SetPosition(520,-600); met[4]->SetPosition(320,-400); /*met[5]->SetPosition(620,-400); met[6]->SetPosition(100,-400); */ int bulletCount = 0; vector<Bullet*> bulletVector; vector<Meteor*> meteorVector; for(int i = 0; i<METEORCOUNT; i++) { meteorVector.push_back(met[i]); } bool fired = false; bool pressed = false; int count; bool change = false; //win.UseVerticalSync(true); //win.SetFramerateLimit(60); int type = pistol; Image sunImg; sunImg.LoadFromFile("..\\Resources\\Sun.png"); Sprite sunSp(sunImg); sunSp.SetPosition(500,2000); //void* user; //int score = 0; // enemys e(vMode); //Thread thread(Thread::FuncType Move,void* enemy, void* &win, void* ship); m.Play(); while(win.IsOpened()) { while(win.GetEvent(events)) { if(events.Type == Event::Closed) { win.Close(); return -1; } if((events.Type == Event::KeyPressed) && (events.Key.Code == Key::Escape)) { return 0; } if(ship.IsDestroyed() && ((events.Type == Event::KeyPressed) && (events.Key.Code == Key::Return))) { return 0; } } if(win.GetInput().IsKeyDown(Key::Up) && !ship.IsDestroyed()) { ship.Throttled(); } if(!win.GetInput().IsKeyDown(Key::Up)&& !ship.IsDestroyed()) { ship.NoThrottle(); key = false; } if(!win.GetInput().IsKeyDown(Key::Right) && !win.GetInput().IsKeyDown(Key::Up) && !ship.IsDestroyed()) { ship.NoThrottle(); } if(!win.GetInput().IsKeyDown(Key::Left)&& !win.GetInput().IsKeyDown(Key::Up) && !ship.IsDestroyed()) { ship.NoThrottle(); } if(win.GetInput().IsKeyDown(Key::Right) && !ship.IsDestroyed()) { ship.Right(); if(ship.GetPositionX()<=vMode.Width) { //ship.SetSpeed(100); ship.AddVelocity(300,0); ship.MoveSide(win.GetFrameTime()); } } if(win.GetInput().IsKeyDown(Key::Left) && !ship.IsDestroyed()) { ship.Left(); if(ship.GetPositionX()>=0) { ship.AddVelocity(-300,0); //ship.SetSpeed(-100); ship.MoveSide(win.GetFrameTime()); } } if(win.GetInput().IsKeyDown(Key::LShift)) { ship.TellDestroyed(); //ship.Destroyed(); //win.Close(); } if(win.GetInput().IsKeyDown(Key::B)) { } if(win.GetInput().IsKeyDown(Key::Space) && !ship.IsDestroyed()&&!pressed) { playerSound.Play(); bul = new Bullet(bullets, vMode, &ship, type); //bul->ChangeType(type); //bul->ChangeType(pistol); bulletVector.push_back(bul); count = bulletVector.size(); //cout<<count; pressed = true; } if(!win.GetInput().IsKeyDown(Key::Space)) { pressed = false; } if(win.GetInput().IsKeyDown(Key::N)) { type = laser; for(int i = 0; i< METEORCOUNT; i++) { met[i]->SetDestroyed(); } } win.Clear(); ship.MoveUp(win.GetFrameTime()); if(enemy.GetPositionY()>ship.GetPositionY()-500) { enemy.MoveUp(&win, ship); //enemy.NavigatorUp(&win, ship); } //ship.Simulate(win.GetFrameTime(), key, down); for(int i = 0; i<10; i++) { if(spStar[i].GetPosition().y>ship.GetPositionY() + 50) { lowesty=(int)ship.GetPositionY(), highesty=(int)ship.GetPositionY()-600; rangey=(highesty-lowesty)+1; random_integery; random_integery = lowesty+int(rangey*rand()/(RAND_MAX + 1.0)); //cout << random_integery << endl; lowestx=0, highestx=800; rangex=(highestx-lowestx)+1; random_integerx; random_integerx = lowestx+int(rangex*rand()/(RAND_MAX + 1.0)); //cout << random_integerx << endl; spStar[i].SetPosition((float)random_integerx, (float)random_integery); } } for(int i = 0; i<METEORCOUNT; i++) { if(ship.GetPositionY()<=-2000)//Score compare { met[i]->ChangeSpeed(); } met[i]->Update(win.GetFrameTime()); if(met[i]->GetPositionY()>ship.GetPositionY() + 50) { lowesty=(int)ship.GetPositionY() - 600, highesty=(int)ship.GetPositionY()-1200; rangey=(highesty-lowesty)+1; random_integery; random_integery = lowesty+int(rangey*rand()/(RAND_MAX + 1.0)); //cout << random_integery << endl; lowestx=0, highestx=720; rangex=(highestx-lowestx)+1; random_integerx; random_integerx = lowestx+int(rangex*rand()/(RAND_MAX + 1.0)); // cout << random_integerx << endl; if(met[i]->IsDestroyed()) { met[i]->SetAlive(); } met[i]->SetPosition(random_integerx, random_integery); if(!ship.IsDestroyed()) { ship.IncreaseScore(); ship.UpdateScore(); } } met[i]->UpdateAI(); } if(enemy.IsFired()) { if(col.PixelPerfectTest(enemy.GetBullet(), ship.GetSprite())) { //ship.TellDestroyed(); ship.DecreaseHealth(); if(ship.GetHealth()<=0) { ship.TellDestroyed(); } enemy.BulletReset(); enemy.NotAttacking(); } } if(!meteorVector.empty()) { for(int i = 0; i<METEORCOUNT; i++) { if(col.CircleTest(enemy.GetBullet(), meteorVector[i]->GetSprite())) { //win.Close(); //ship.TellDestroyed(); met[i]->SetDestroyed(); meteorSound.Play(); enemy.BulletReset(); } if(col.CircleTest(ship.GetSprite(), meteorVector[i]->GetSprite())) { //win.Close(); ship.TellDestroyed(); met[i]->SetDestroyed(); } if(col.CircleTest(ship.GetSprite(), sunSp)) { //win.Close(); ship.TellDestroyed(); //met[i]->SetDestroyed(); } if(col.PixelPerfectTest(enemy.GetSprite(), meteorVector[i]->GetSprite())) { //win.Close(); enemy.DecreaseHealth(10); met[i]->SetDestroyed(); meteorSound.Play(); } if(col.PixelPerfectTest(enemy.GetSprite(), sunSp)) { //win.Close(); enemy.DecreaseHealth(20); //met[i]->SetDestroyed(); } // if(col.PixelPerfectTest(meteorVector[i]->GetSprite(), enemy.GetNavigator2())||(col.PixelPerfectTest(meteorVector[i]->GetSprite(), enemy.GetNavigator3())||(col.PixelPerfectTest(sunSp, enemy.GetNavigator3()) ))) { //win.Close(); enemy.MoveLeft(1, &win, ship); } else if(col.PixelPerfectTest(meteorVector[i]->GetSprite(), enemy.GetNavigator1())||(col.PixelPerfectTest(meteorVector[i]->GetSprite(), enemy.GetNavigator4())||(col.PixelPerfectTest(sunSp, enemy.GetNavigator4()) ))) { //win.Close(); enemy.MoveRight(&win, ship); } else { enemy.Attacking(); enemy.UpdatePlayerPosition(ship.GetSprite().GetPosition(), &win); } if(!bulletVector.empty()) { for(int j = 0; j< (int)bulletVector.size(); j++) { //if((bulletVector[j]->GetSprite().GetPosition().x >= meteorVector[i]->GetSprite().GetPosition().x && bulletVector[j]->GetSprite().GetPosition().x < meteorVector[i]->GetSprite().GetPosition().x +meteorVector[i]->GetSprite().GetSize().x ) && (bulletVector[j]->GetSprite().GetPosition().y >= meteorVector[i]->GetSprite().GetPosition().y && bulletVector[j]->GetSprite().GetPosition().y < meteorVector[i]->GetSprite().GetPosition().y + meteorVector[i]->GetSprite().GetSize().x)) //{ // //win.Close(); // bulletVector[j]->Hit(); // meteorVector[i]->SetDestroyed(); // delete bulletVector[j]; // bulletVector.erase(bulletVector.begin() + j); //} if(col.PixelPerfectTest(enemy.GetBullet(), ship.GetSprite())) { //ship.TellDestroyed(); /*ship.DecreaseHealth(); if(ship.GetHealth()<=0) { ship.TellDestroyed(); }*/ } if(col.PixelPerfectTest(bulletVector[j]->GetSprite(), enemy.GetSprite())) { enemy.DecreaseHealth(); meteorSound.Play(); bulletVector[j]->Hit(); delete bulletVector[j]; bulletVector.erase(bulletVector.begin() + j); } else if(col.PixelPerfectTest(bulletVector[j]->GetSprite(), meteorVector[i]->GetSprite())) { bulletVector[j]->Hit(); meteorVector[i]->SetDestroyed(); meteorSound.Play(); delete bulletVector[j]; bulletVector.erase(bulletVector.begin() + j); } //if(col.BoundingBoxTest(bulletVector[j]->GetBulletSprite(), meteorVector[i]->GetSprite()))//collision condition should be checked here bullet and other ships //{ // cout<<i<<"T"; // cout<<j<<"T"; // win.Close(); // bulletVector[j]->Hit(); //} } } } } ship.UpdateAI(); if(enemy.GetPositionY()>ship.GetPositionY()-700) enemy.UpdateAI(); if(enemy.IsDestroyed()) { lowestx=200, highestx=620; rangex=(highestx-lowestx)+1; random_integerx; random_integerx = lowestx+int(rangex*rand()/(RAND_MAX + 1.0)); enemy.EnemyReset(random_integerx, ship); if(!ship.IsDestroyed()) { ship.IncreaseScore(10); ship.UpdateScore(); } } //win.Draw(sp); //win.Draw(sp2); //win.Draw(sp3); ship.UpdateHealth(); Drawing drawing; drawing.win = &win; drawing.ship = &ship; drawing.enemy = &enemy; drawing.Bulletvectors = bulletVector; drawing.MeteorCounts = METEORCOUNT; for(int i = 0; i<5; i++) drawing.met[i] = met[i]; win.Draw(sunSp); for(int i = 0; i< 10; i++) win.Draw(spStar[i]); //win.Draw(spStar1); //ship.UpdateScore(); // DrawingTHread(drawing); ship.Draw(&win); //score.SetPosition(100,100); //win.Draw(score); if(enemy.GetPositionY()>ship.GetPositionY()-700) enemy.Draw(&win, ship); for(int i = 0; i<METEORCOUNT; i++) { met[i]->Draw(&win); } if(!bulletVector.empty()) { for(int i = 0; i<(int)bulletVector.size();i++) { //d.Bulletvectors[i]->ChangeType(type); bulletVector[i]->Fired(); bulletVector[i]->Draw(&win, &ship); bulletVector[i]->UpdateBullet(win.GetFrameTime()); bulletVector[i]->UpdateAI(); //if(d.Bulletvectors[i]->GetPositiony()<=ship.GetPositionY()-500) win.Close(); if(bulletVector[i]->GetPositiony()<ship.GetPositionY()-600) { delete bulletVector[i]; bulletVector.erase(bulletVector.begin()+i); //count = d.Bulletvectors.size(); //cout<<count<<"\n"; } } } win.SetView(ship.GetView()); win.Display(); } return 1; }
void draw(RenderWindow & Target) { Target.Draw(sprite); Target.Draw(text); }
//metodo que dibuja el sprite void Dibujar(){ wnd->Draw(*_sprite); }