00001 /* 00002 * ExNihilo 3D Engine 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 * 00018 * Please read AUTHORS file !!! 00019 * 00020 * $Id: ExManagerParticuleSystem.cpp,v 1.10 2002/08/01 18:45:58 data Exp $ 00021 * 00022 */ 00023 #include "ExManagerParticuleSystem.h" 00024 00025 ExManagerParticuleSystem::ExManagerParticuleSystem(void) 00026 { 00027 Guard(ExManagerParticuleSystem::ExManagerParticuleSystem(void)) 00028 m_VecParticuleSysteme = new std::vector<ExCSystemeParticule>; 00029 m_VecPParticuleSysteme = new std::vector<ExCSystemeParticule *>; 00030 UnGuard 00031 } 00032 00033 00034 ExManagerParticuleSystem::~ExManagerParticuleSystem(void) 00035 { 00036 Guard(ExManagerParticuleSystem::~ExManagerParticuleSystem(void)) 00037 UnGuard 00038 } 00039 00040 00041 bool ExManagerParticuleSystem::LoadParticuleSysteme(const char * FileName) 00042 { 00043 Guard(bool ExManagerParticuleSystem::LoadParticuleSysteme(const char * FileName)) 00044 ExCSystemeParticule systeme; 00045 systeme.WriteToConsol=WriteToConsol; 00046 if(systeme.LoadParticuleSysteme(FileName)) 00047 { 00048 m_VecParticuleSysteme->push_back(systeme); 00049 CreateVecPobject(); 00050 return true; 00051 } 00052 return false; 00053 UnGuard 00054 } 00055 00056 int ExManagerParticuleSystem::StartParticuleSysteme(char *param) 00057 { 00058 Guard(int ExManagerParticuleSystem::StartParticuleSysteme(char *param)) 00059 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00060 { 00061 if(strcmp(m_ItVecParticuleSysteme->GetParticuleSystemeName(),param)==0) 00062 { 00063 m_ItVecParticuleSysteme->Start(); 00064 } 00065 } 00066 return GetNumberEnableParticuleSysteme(); 00067 UnGuard 00068 } 00069 00070 int ExManagerParticuleSystem::StopParticuleSysteme(char *param) 00071 { 00072 Guard(int ExManagerParticuleSystem::StopParticuleSysteme(char *param)) 00073 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00074 { 00075 if(strcmp(m_ItVecParticuleSysteme->GetParticuleSystemeName(),param)==0) 00076 { 00077 m_ItVecParticuleSysteme->Stop(); 00078 } 00079 } 00080 return GetNumberEnableParticuleSysteme(); 00081 UnGuard 00082 } 00083 00084 int ExManagerParticuleSystem::PauseParticuleSysteme(char *param) 00085 { 00086 Guard(int ExManagerParticuleSystem::PauseParticuleSysteme(char *param)) 00087 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00088 { 00089 if(strcmp(m_ItVecParticuleSysteme->GetParticuleSystemeName(),param)==0) 00090 { 00091 m_ItVecParticuleSysteme->Pause(); 00092 } 00093 } 00094 return GetNumberEnableParticuleSysteme(); 00095 UnGuard 00096 } 00097 00098 int ExManagerParticuleSystem::StartAllParticuleSysteme(void) 00099 { 00100 Guard(int ExManagerParticuleSystem::StartAllParticuleSysteme(void)) 00101 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00102 { 00103 m_ItVecParticuleSysteme->Start(); 00104 } 00105 return GetNumberEnableParticuleSysteme(); 00106 UnGuard 00107 } 00108 00109 int ExManagerParticuleSystem::StopAllParticuleSysteme(void) 00110 { 00111 Guard(int ExManagerParticuleSystem::StopAllParticuleSysteme(void)) 00112 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00113 { 00114 m_ItVecParticuleSysteme->Stop(); 00115 } 00116 return GetNumberEnableParticuleSysteme(); 00117 UnGuard 00118 } 00119 00120 int ExManagerParticuleSystem::PauseAllParticuleSysteme(void) 00121 { 00122 Guard(int ExManagerParticuleSystem::PauseAllParticuleSysteme(void)) 00123 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00124 { 00125 m_ItVecParticuleSysteme->Pause(); 00126 } 00127 return GetNumberEnableParticuleSysteme(); 00128 UnGuard 00129 } 00130 00131 void ExManagerParticuleSystem::ListParticuleSysteme(void) 00132 { 00133 Guard(void ExManagerParticuleSystem::ListParticuleSysteme(void)) 00134 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++) 00135 { 00136 if(m_ItVecParticuleSysteme->GetParticuleSystemeState()) 00137 { 00138 *Consol<<"ParticuleSysteme :"<<m_ItVecParticuleSysteme->GetParticuleSystemeName()<<" State : Enable"<<std::endl; 00139 }else 00140 { 00141 *Consol<<"ParticuleSysteme :"<<m_ItVecParticuleSysteme->GetParticuleSystemeName()<<" State : Disable"<<std::endl; 00142 } 00143 } 00144 UnGuard 00145 } 00146 00147 void ExManagerParticuleSystem::CreateVecPobject(void) 00148 { 00149 Guard(void ExManagerParticuleSystem::CreateVecPobject(void)) 00150 m_VecPParticuleSysteme->clear(); 00151 int i=0; 00152 for(m_ItVecParticuleSysteme=m_VecParticuleSysteme->begin();m_ItVecParticuleSysteme!=m_VecParticuleSysteme->end();m_ItVecParticuleSysteme++,i++) 00153 { 00154 m_VecPParticuleSysteme->push_back(&m_VecParticuleSysteme->at(i)); 00155 } 00156 *Consol<<"Number of Particule syteme :"<<m_VecPParticuleSysteme->size()<<std::endl; 00157 UnGuard 00158 }