#include "Balle.h" Balle::Balle(int nbRqt) :m_nbRqt(nbRqt), m_point(RAYON_BALLE,BLEU), m_position(RAYON_FENETRE, RAYON_FENETRE), m_trajectoire(rand()-RAND_MAX/2, rand()-RAND_MAX/2), m_vitesse((float)VITESSE_MAX/4), m_centre(RAYON_FENETRE, RAYON_FENETRE) { //[1] Renplit le tableau de pointeurs for (int i(0); i= 0 && slotgetAngleActuel()); Vecteur tmp(m_position-m_centre); tmp.rotate(5); droite = (tmp.scalair(m_tableauRqt[i]->getAngleActuel())format, 255, 0, 0)); SDL_Rect pos; for(int y = -RAYON_TERRAIN;y < RAYON_TERRAIN; y++) for(int x = -RAYON_TERRAIN;x < RAYON_TERRAIN; x++) { if(x*x+y*y0 && ((m_position.getX()-RAYON_TERRAIN)+(m_position.getY()-RAYON_TERRAIN)*1.75>0)) || (x*(m_position.getX()-RAYON_FENETRE)>0 && ((x-(y*1.75)>0 && ((m_position.getX()-RAYON_TERRAIN)-(m_position.getY()-RAYON_TERRAIN)*1.75>0) && m_position.getX()-RAYON_FENETRE>0) || (x+(y*1.75)<0 && ((m_position.getX()-RAYON_TERRAIN)+(m_position.getY()-RAYON_TERRAIN)*1.75<0) && m_position.getX()-RAYON_FENETRE<0))))) || // <- n'est pas fini (m_nbRqt == 4 && (x-y)*((((m_position.getX()-RAYON_TERRAIN)-(m_position.getY()-RAYON_TERRAIN))<0)*2-1)<0 && (x+y)*-((((m_position.getX()-RAYON_TERRAIN)+(m_position.getY()-RAYON_TERRAIN))<0)*2-1)>0))) { pos.x = x+RAYON_FENETRE; pos.y = y+RAYON_FENETRE; SDL_BlitSurface(pixel, 0, screen, &pos); } } SDL_Flip(screen); SDL_Delay(200); }