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

ExCLoadingAnimation.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  
00021  *
00022  */
00023 
00024 #include "ExCLoadingAnimation.h"
00025 
00026 ExCLoadingAnimation::ExCLoadingAnimation(void)
00027 {
00028         SetName("ExCLoadingAnimation");
00029         SetType(typeid(this).name());
00030         m_NumberAnimTexture=0;
00031         m_CurrentAnimationTexture=0;
00032 }
00033 
00034 ExCLoadingAnimation::~ExCLoadingAnimation(void)
00035 {
00036 }
00037 
00038 void ExCLoadingAnimation::Draw(void)
00039 {
00040 Guard(void ExCLoadingAnimation::Draw(void))
00041         ExNihilo::EnterOrthoMode();
00042                 //ManagerTexture->Add(m_VecAnimTexture.at(m_CurrentAnimationTexture));  
00043                 if(m_CurrentAnimationTexture>=m_VecAnimTexture.size())m_CurrentAnimationTexture=m_VecAnimTexture.size()-1;
00044                 ManagerTexture->SetCurrentObject(m_VecAnimTexture.at(m_CurrentAnimationTexture));       
00045                 glEnable(GL_TEXTURE_2D);
00046                 glDisable(GL_LIGHTING);
00047                 glBegin(GL_QUADS);
00048                 glColor3f(1.0f,1.0f,1.0f);
00049                 glTexCoord2f(0,1);
00050                 glVertex2f(0,0);
00051                 glTexCoord2f(0,0);
00052                 glVertex2f(0,ExNihilo::GetResolutionY());
00053                 glTexCoord2f(1,0);
00054                 glVertex2f(ExNihilo::GetResolutionX(),ExNihilo::GetResolutionY());
00055                 glTexCoord2f(1,1);
00056                 glVertex2f(ExNihilo::GetResolutionX(),0);
00057                 glEnd();
00058         ExNihilo::LeaveOrthoMode();
00059 UnGuard
00060 }
00061 
00062 
00063 void ExCLoadingAnimation::Load(std::string FileName)
00064 {
00065 Guard(void ExCLoadingAnimation::Load(std::string FileName))
00066         m_CurrentAnimationTexture=0;
00067         char                    buffer[255];
00068         #ifdef UNIX_SRC
00069                 sprintf(buffer, PREFIX "/ExNihilo/Data/Loading/%s", FileName.data());
00070         #else
00071                 sprintf(buffer, "../Data/Loading/%s", FileName.data());
00072         #endif
00073                 std::ifstream fin;
00074                 std::string buffstring;
00075                 char b[256];
00076                 fin.open(buffer,std::ios::in);
00077                 if(fin.is_open())
00078                 {
00079                         try
00080                         {
00081                                 //----Read all file
00082                                 do
00083                                 {
00084                                         memset(b,0,255);
00085                                         fin.getline(b,256,'\n');
00086                                         try
00087                                         {
00088                                                 m_NumberAnimTexture++;
00089                                                 m_VecAnimTexture.push_back(ExNihilo::ExtracValueFromSring(b,"<Frame>","<#Frame>"));
00090                                         }catch(ExCExpStringNotFound){}
00091                                 }while(!fin.eof());
00092                                 fin.close();
00093                         }catch(...){throw ExCExpFileReadError();}
00094                 }else throw   ExCExpFileNotFound();
00095 
00096 UnGuard
00097 }
00098 
00099 bool ExCLoadingAnimation::Next(void)
00100 {
00101 Guard(bool ExCLoadingAnimation::Next(void))
00102         if(m_CurrentAnimationTexture>=m_NumberAnimTexture)
00103         {
00104                 m_CurrentAnimationTexture=0;return false;
00105         }else
00106         {
00107                 m_CurrentAnimationTexture++;return true;
00108         }
00109 UnGuard
00110 }
00111 
00112 
00113 bool ExCLoadingAnimation::Previous(void)
00114 {
00115 Guard(bool ExCLoadingAnimation::Previous(void))
00116         if(m_CurrentAnimationTexture<=0)
00117         {
00118                 m_CurrentAnimationTexture=0;return false;
00119         }else
00120         {
00121                 m_CurrentAnimationTexture--;return true;
00122         }
00123 UnGuard
00124 }
00125 
00126 void ExCLoadingAnimation::Last(void)
00127 {
00128 Guard(void ExCLoadingAnimation::Last(void))
00129         m_CurrentAnimationTexture=m_NumberAnimTexture;
00130 UnGuard
00131 }
00132 
00133 void ExCLoadingAnimation::First(void)
00134 {
00135 Guard(void ExCLoadingAnimation::First(void))
00136         m_CurrentAnimationTexture=0;
00137 UnGuard
00138 }

Généré le Tue Oct 28 12:43:31 2003 pour ExNihilo par doxygen 1.3.4