Page principale | Liste des namespaces | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Membres des namespaces | Composants | Déclarations

# ExManagerParticuleSystem.cpp

Aller à la documentation de ce fichier.

    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.17 2002/11/24 11:58:58 data Exp $
    00021  *
    00022  */
    00023 #include "ExManagerParticuleSystem.h"
    00024
    00025 bool ExManagerParticuleSystem::m_flag = false;
    00026 ExManagerParticuleSystem* ExManagerParticuleSystem::m_instance = NULL;
    00027
    00028 ExManagerParticuleSystem* ExManagerParticuleSystem::CreateSingleton(void){
    00029 Guard(ExManagerParticuleSystem* ExManagerParticuleSystem::CreateSingleton(void))
    00030         if(!m_flag)
    00031         {
    00032                 m_flag = true; // We are creating the error log now, so set flag to true
    00033                 m_instance = new ExManagerParticuleSystem; // Create the error log
    00034         }else
    00035         {
    00036                 std::cout<<"Error singleton already created"<<std::endl;
    00037         }
    00038         return m_instance;
    00039 UnGuard
    00040 }
    00041
    00042 ExManagerParticuleSystem::ExManagerParticuleSystem(void)
    00043 {
    00044 Guard(ExManagerParticuleSystem::ExManagerParticuleSystem(void))
    00045
    00046 UnGuard
    00047 }
    00048
    00049
    00050 ExManagerParticuleSystem::~ExManagerParticuleSystem(void)
    00051 {
    00052 Guard(ExManagerParticuleSystem::~ExManagerParticuleSystem(void))
    00053 UnGuard
    00054 }
    00055
    00056 void ExManagerParticuleSystem::Init(void)
    00057 {
    00058 Guard(void ExManagerModel::Init(void))
    00059         ExManagerObject<ExCSystemeParticule>::Init();
    00060 UnGuard
    00061 }
    00062
    00063 void ExManagerParticuleSystem::Reset(void)
    00064 {
    00065         ExManagerObject<ExCSystemeParticule>::Reset();
    00066 }
    00067
    00068 bool ExManagerParticuleSystem::Load(std::string  FileName)
    00069 {
    00070 Guard(bool ExManagerParticuleSystem::Load(std::string FileName))
    00071     FileName="../Data/ParticuleSystem/"+FileName;
    00072         try
    00073         {
    00074                 ExCSystemeParticule     systeme;
    00075                 systeme.Consol=Consol;
    00076                 systeme.SetManagerTexture(ManagerTexture);
    00077                 systeme.SetManagerCollision(ManagerCollision);
    00078                 systeme.Load(FileName);
    00079                 return ExManagerObject<ExCSystemeParticule>::Add(systeme);
    00080         }
    00081         catch(ExCExpFileNotFound)
    00082         {
    00083                 *Consol<<"ExManagerParticuleSystem::ExCeption =>"<<FileName<<" File not found"<<std::endl;
    00084                 return false;
    00085         }
    00086         catch(ExCExpFileReadError)
    00087         {
    00088                 *Consol<<"ExManagerParticuleSystem::ExCeption =>"<<FileName<<" Read file error"<<std::endl;
    00089                 return false;
    00090         }
    00091         catch(...)
    00092         {
    00093                 *Consol<<"ExManagerParticuleSystem::ExCeption =>"<<FileName<<" Unknow exception"<<std::endl;
    00094                 return false;
    00095         }
    00096 UnGuard
    00097 }
    00098
    00099 int ExManagerParticuleSystem::Start(std::string Name)
    00100 {
    00101 Guard(int ExManagerParticuleSystem::Start(std::string Name))
    00102         /*for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00103         {
    00104                 if(strcmp(m_ItMap->GetParticuleSystemeName(),param.data())==0)
    00105                 {
    00106                         m_ItMap->Start();
    00107                 }
    00108         }
    00109          */
    00110         return GetNumberEnableParticuleSysteme();
    00111 UnGuard
    00112 }
    00113
    00114 int ExManagerParticuleSystem::Stop(std::string Name)
    00115 {
    00116 Guard(int ExManagerParticuleSystem::Stop(std::string Name))
    00117         /*for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00118         {
    00119                 if(strcmp(m_ItMap->GetParticuleSystemeName(),param.data())==0)
    00120                 {
    00121                         m_ItMap->Stop();
    00122                 }
    00123         }*/
    00124         return GetNumberEnableParticuleSysteme();
    00125 UnGuard
    00126 }
    00127
    00128 int ExManagerParticuleSystem::Pause(std::string Name)
    00129 {
    00130 Guard(int ExManagerParticuleSystem::Pause(std::string Name))
    00131         /*for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00132         {
    00133                 if(strcmp(m_ItMap->GetParticuleSystemeName(),param.data())==0)
    00134                 {
    00135                         m_ItMap->Pause();
    00136                 }
    00137         }*/
    00138         return GetNumberEnableParticuleSysteme();
    00139 UnGuard
    00140 }
    00141
    00142 int ExManagerParticuleSystem::StartAll(void)
    00143 {
    00144 Guard(int ExManagerParticuleSystem::StartAll(void))
    00145         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00146         {
    00147                 m_ItMap->second.Start();
    00148         }
    00149         return GetNumberEnableParticuleSysteme();
    00150 UnGuard
    00151 }
    00152
    00153 void ExManagerParticuleSystem::Draw(void)
    00154 {
    00155 Guard(void ExManagerParticuleSystem::Draw(void))
    00156         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00157         {
    00158                 m_ItMap->second.Draw();
    00159         }
    00160 UnGuard
    00161 }
    00162
    00163 int ExManagerParticuleSystem::StopAll(void)
    00164 {
    00165 Guard(int ExManagerParticuleSystem::StopAll(void))
    00166         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00167         {
    00168                 m_ItMap->second.Stop();
    00169         }
    00170         return GetNumberEnableParticuleSysteme();
    00171 UnGuard
    00172 }
    00173
    00174 int ExManagerParticuleSystem::PauseAll(void)
    00175 {
    00176 Guard(int ExManagerParticuleSystem::PauseAll(void))
    00177         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00178         {
    00179                 m_ItMap->second.Pause();
    00180         }
    00181         return GetNumberEnableParticuleSysteme();
    00182 UnGuard
    00183 }
    00184
    00185
    00186
    00187 ExCAction ExManagerParticuleSystem::InputCommand(ExCCommand Command)
    00188 {
    00189 Guard(ExCAction ExManagerParticuleSystem::InputCommand(ExCCommand Command))
    00190         return NOTHING;
    00191 UnGuard
    00192 }
    00193
    00194 ExCAction ExManagerParticuleSystem::InputAction(ExCAction Action)
    00195 {
    00196 Guard(ExCAction ExManagerParticuleSystem::InputAction(ExCAction Action))
    00197         switch(Action.m_Action)
    00198         {
    00199         case LOAD_PARTICULESYSTEME:Load(Action.m_Param);break;
    00200     case STAR_PARTICULESYSTEME:GetObject(Action.m_Param)->Start();break;
    00201         case STOP_PARTICULESYSTEME:GetObject(Action.m_Param)->Stop();break;
    00202         case PAUSE_PARTICULESYSTEME:GetObject(Action.m_Param)->Pause();break;
    00203         case STAR_ALL_PARTICULESYSTEME:StartAll();break;
    00204         case STOP_ALL_PARTICULESYSTEME:StopAll();break;
    00205         case PAUSE_ALL_PARTICULESYSTEME:PauseAll();break;
    00206         case LIST_PARTICULESYSTEME:List();break;
    00207
    00208         default:
    00209                 *Consol<<"Can not file action in PARTICULESYSTEME_ACTION_MAP"<<std::endl;
    00210                 break;
    00211         }
    00212         if(Action.m_NextAction){return *Action.m_NextAction;}
    00213         else{return NOTHING;}
    00214 UnGuard
    00215 }
    00216