00001 00002 // Shoot(r) 00009 00010 #include "ctrl_fenetre.h" 00011 #include "fx.h" 00012 #include <stdio.h> 00013 00014 CParticleSystem::CParticleSystem () 00015 { 00016 m_bSupprime = false; 00017 00018 // Initialise tous les pointeurs sur particules à 0 pour pouvoir vérifier qu'ils sont utilisés ou non. 00019 for (int i = 0; i < PARTICULE_NOMBRE; i++) 00020 m_pParticule[i] = 0; 00021 00022 m_Timer.Init (); 00023 } 00024 00025 CParticleSystem::~CParticleSystem () 00026 { 00027 // Destruction des particules. 00028 for (int i = 0; i < PARTICULE_NOMBRE; i++) 00029 { 00030 if (m_pParticule[i]) 00031 { 00032 delete m_pParticule[i]; 00033 m_pParticule[i] = 0; 00034 } 00035 } 00036 } 00037 00038 // Offre un accès aux particules. On prend soin de vérifier que l'index indentifie bien une entrée de la table 00039 const CParticule* const CParticleSystem::GetParticuleParIndex (unsigned int uiIndex) const 00040 { 00041 if (uiIndex < PARTICULE_NOMBRE) 00042 return m_pParticule[uiIndex]; 00043 return 0; 00044 } 00045 00046 // Recherche d'un index libre dans la table des particules 00047 int CParticleSystem::GetIndexLibre () const 00048 { 00049 for (int i = 0; i < PARTICULE_NOMBRE; i++) 00050 if (!m_pParticule[i]) 00051 return i; 00052 return -1; 00053 } 00054 00055 // Détermine si un objet rond centrée sur Position est dans l'écran 00056 bool CParticleSystem::EstDansEcran (CVecteur Position, float fRayon) const 00057 { 00058 if (Position (gtl::X) < (0 - fRayon)) 00059 return false; 00060 if (Position (gtl::X) > (FENETRE_LARGEUR + fRayon)) 00061 return false; 00062 if (Position (gtl::Y) < (0 - fRayon)) 00063 return false; 00064 if (Position (gtl::Y) > (FENETRE_HAUTEUR + fRayon)) 00065 return false; 00066 return true; 00067 }
1.3.8