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

# ExManagerAnimation.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: ExManagerAnimation.cpp,v 1.7 2002/09/22 15:54:01 data Exp $
    00021  *
    00022  */
    00023 #include "ExManagerAnimation.h"
    00024
    00025 bool ExManagerAnimation::m_flag = false;
    00026 ExManagerAnimation* ExManagerAnimation::m_instance = NULL;
    00027
    00028 ExManagerAnimation* ExManagerAnimation::CreateSingleton(void){
    00029 Guard(ExManagerAnimation* ExManagerAnimation::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 ExManagerAnimation; // 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 ExManagerAnimation::ExManagerAnimation(void)
    00043 {
    00044 Guard(ExManagerAnimation::ExManagerAnimation(void))
    00045 UnGuard
    00046 }
    00047
    00048 ExManagerAnimation::~ExManagerAnimation(void)
    00049 {
    00050 Guard(ExManagerAnimation::~ExManagerAnimation(void))
    00051 UnGuard
    00052 }
    00053
    00054 void ExManagerAnimation::Reset(void)
    00055 {
    00056 Guard(void ExManagerAnimation::Reset(void))
    00057         ExManagerObject<ExCAnimation>::Reset();
    00058 UnGuard
    00059 }
    00060
    00061 void ExManagerAnimation::Reload(void)
    00062 {
    00063 Guard(void ExManagerAnimation::Reload(void))
    00064         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00065         {
    00066                 m_ItMap->second.LoadFile(m_ItMap->second.GetFileName());
    00067         }
    00068 UnGuard
    00069 }
    00070
    00071 bool ExManagerAnimation::Load(std::string FileName)
    00072 {
    00073 Guard(void ExManagerAnimation::Load(std::string FileName))
    00074         ExCAnimation Anim;
    00075         Anim.SetManagerCamera(ManagerCamera);
    00076         Anim.SetManagerId(ManagerId);
    00077         Anim.SetManagerModel(ManagerModel);
    00078         Anim.SetManagerEntity(ManagerEntity);
    00079         Anim.LoadFile(FileName);
    00080         //Anim.m_Object=ManagerModel->GetCurrentObject();
    00081         //Anim.m_Object=ManagerCamera->GetCurrentObject();
    00082         return ExManagerObject<ExCAnimation>::Add(Anim);
    00083 UnGuard
    00084 }
    00085
    00086
    00087 void ExManagerAnimation::Init(void)
    00088 {
    00089 Guard(void ExManagerAnimation::Init(void))
    00090         ExManagerObject<ExCAnimation>::Init();
    00091         //ExCAnimation Anim1;
    00092         //Anim1.m_Object=ManagerModel->GetCurrentObject();
    00093         //Anim1.m_Object=ManagerCamera->GetCurrentObject();
    00094         //ExManagerObject<ExCAnimation>::Add(Anim1);
    00095 UnGuard
    00096 }
    00097
    00098 void ExManagerAnimation::Draw(void)
    00099 {
    00100 Guard(void ExManagerAnimation::Draw(void))
    00101         for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00102         {
    00103                 m_ItMap->second.Draw();
    00104         }
    00105 UnGuard
    00106 }
    00107
    00108 ExCAction ExManagerAnimation::InputCommand(ExCCommand Command)
    00109 {
    00110 Guard(ExCAction ExManagerAnimation::InputCommand(ExCCommand Command))
    00111 /*      switch(Command.m_Command)
    00112         {
    00113                 default :return NOTHING;
    00114         }*/
    00115         return NOTHING;
    00116 UnGuard
    00117 }
    00118
    00119 ExCAction ExManagerAnimation::InputAction(ExCAction Action)
    00120 {
    00121 Guard(ExCAction ExManagerAnimation::InputAction(ExCAction Action))
    00122         switch(Action.m_Action)
    00123         {
    00124         case MANAGER_ANIMATION_RELOAD:
    00125                 Reload();
    00126                 *Consol<<"ExManagerAnimation::Reload sucess"<<std::endl;
    00127                 break;
    00128         case MANAGER_ANIMATION_PAUSE_ALL_ANIMATION:
    00129                 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00130                 {
    00131                         m_ItMap->second.SetPauseState(true);
    00132                 }
    00133                 break;
    00134         case MANAGER_ANIMATION_UNPAUSE_ALL_ANIMATION:
    00135                 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00136                 {
    00137                         m_ItMap->second.SetPauseState(false);
    00138                 }
    00139                 break;
    00140         case MANAGER_ANIMATION_TOGGLE_PAUSE_ALL_ANIMATION:
    00141                 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00142                 {
    00143                         m_ItMap->second.SetPauseState(!m_ItMap->second.GetPauseState());
    00144                 }
    00145                 break;
    00146         case MANAGER_ANIMATION_PAUSE_ANIMATION:
    00147                 GetCurrentObject()->SetPauseState(true);
    00148                 break;
    00149         case MANAGER_ANIMATION_UNPAUSE_ANIMATION:
    00150                 GetCurrentObject()->SetPauseState(false);
    00151                 break;
    00152         case MANAGER_ANIMATION_TOGGLE_ANIMATION:
    00153                 GetCurrentObject()->SetPauseState(GetCurrentObject()->GetPauseState());
    00154                 break;
    00155         case MANAGER_ANIMATION_SET_CURRENT_OBJECT_BY_ID:
    00156                 SetCurrentObject(atoi(Action.m_Param.data()));
    00157                 break;
    00158         case MANAGER_ANIMATION_SET_CURRENT_OBJECT_BY_NAME:
    00159                 SetCurrentObject(Action.m_Param);
    00160                 break;
    00161         default:
    00162                 *Consol<<"Can not file action in ANIMATION_ACTION_MAP"<<std::endl;
    00163                 return NOTHING;
    00164         }
    00165         return NOTHING;
    00166 UnGuard
    00167 }
    00168
    00169 ExCAnimation* ExManagerAnimation::GetCurrentObject(void)
    00170 {
    00171 Guard(ExCAnimation* ExManagerAnimation::GetCurrentObject(void))
    00172                 return GetObject(m_CurrentObjectId);
    00173 UnGuard
    00174 }
    00175 ExCAnimation * ExManagerAnimation::GetObject(ExNihilo::ExId id)
    00176 {
    00177 Guard(ExCAnimation *ExManagerAnimation::GetObject(ExNihilo::ExId id))
    00178                 for(m_ItMap=m_Map->begin();m_ItMap!=m_Map->end();m_ItMap++)
    00179                 {
    00180                         if(m_ItMap->second.GetId()==id)return &m_ItMap->second;
    00181                 }
    00182                 return NULL;
    00183 UnGuard
    00184 }