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  

Référence de la classe ExCInterface

#include <ExCInterface.h>

Graphe d'héritage de la classe ExCInterface

ExCObject2D ExCObject

Membres publics

 ExCInterface (void)
 ExCInterface (std::string FileName)
 ~ExCInterface (void)
bool LoadFile (std::string FileName)
void SetManagerWindow (ExManagerWindow *Window)
void SetManagerTexture (ExManagerTexture *Texture)
void SetNumInterface (int num)
int GetNumInterface (void)
void ShowRegion (void)
void HideRegion (void)
void DisableInterface (void)
void EnableInterface (void)
bool GetInterfaceState (void)
void Draw (void)
ExCAction InputCommand (int command, int mousex, int mousey)

Attributs Publics

std::ostrstream * Consol

Attributs Privés

ExManagerWindowManagerWindow
ExManagerTextureManagerTexture
std::string m_Texture
std::string m_TextureMask
int m_NumInterface
int m_DefaultResolutionX
int m_DefaultResolutionY
bool m_ShowRegion
bool m_State
std::vector< ActionCommandm_VecActionCommand
std::vector< ActionCommand
>::iterator 
m_ItVecActionCommand

Documentation des contructeurs et destructeurs

ExCInterface void   
 

Définition à la ligne 26 du fichier ExCInterface.cpp.

Références ExCInterface(), Guard, m_ShowRegion, m_State, ExCObject::SetName(), et ExCObject::SetType().

Référencé par ExCInterface(), et ~ExCInterface().

00027 {
00028 Guard(ExCInterface::ExCInterface(void))
00029         m_ShowRegion=true;
00030         m_State=true;
00031         SetName("ExCInterface");
00032         SetType(typeid(this).name());
00033 UnGuard
00034 }

ExCInterface std::string    FileName
 

Définition à la ligne 36 du fichier ExCInterface.cpp.

Références ExCInterface(), Guard, LoadFile(), m_ShowRegion, et m_State.

00037 {
00038 Guard(ExCInterface::ExCInterface(std::string FileName))
00039         m_ShowRegion=true;
00040         m_State=true;
00041         LoadFile(FileName);
00042 UnGuard
00043 }

~ExCInterface void   
 

Définition à la ligne 45 du fichier ExCInterface.cpp.

Références ExCInterface(), et Guard.

00046 {
00047 Guard(ExCInterface::~ExCInterface(void))
00048 UnGuard
00049 }


Documentation des méthodes

void DisableInterface void    [inline]
 

Définition à la ligne 85 du fichier ExCInterface.h.

Références m_ShowRegion.

00085 {m_ShowRegion=false;}

void Draw void    [virtual]
 

Redéfinie à partir de ExCObject.

Définition à la ligne 110 du fichier ExCInterface.cpp.

Références Draw(), ExNihilo::EnterOrthoMode(), Guard, ExNihilo::LeaveOrthoMode(), m_Texture, m_TextureMask, ManagerTexture, et ExManagerTexture::SetCurrentObject().

Référencé par Draw().

00111 {
00112 Guard(void ExCInterface::Draw(void))
00113     glPushMatrix();
00114         ExNihilo::EnterOrthoMode();
00115         
00116         glEnable(GL_TEXTURE_2D);
00117         glDisable(GL_LIGHTING);
00118         glColor4f(1, 1, 1, 1);
00119         glDisable(GL_DEPTH_TEST);
00120         glBlendFunc(GL_DST_COLOR,GL_ZERO);
00121         glEnable(GL_BLEND);                                                                                     
00122         
00123         ManagerTexture->SetCurrentObject(m_TextureMask);
00124         
00125         glBegin(GL_QUADS);
00126                 glTexCoord2f(0.0f, 1.0f);       glVertex2f(0, 0);
00127                 glTexCoord2f(0.0f, 0.0f);       glVertex2f(0,glutGet(GLUT_WINDOW_HEIGHT));
00128                 glTexCoord2f(1.0f, 0.0f);       glVertex2f(glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT));
00129                 glTexCoord2f(1.0f, 1.0f);       glVertex2f(glutGet(GLUT_WINDOW_WIDTH), 0);
00130         glEnd();        
00131 
00132         glBlendFunc(GL_ONE,GL_ONE);
00133         ManagerTexture->SetCurrentObject(m_Texture);
00134         
00135         glBegin(GL_QUADS);
00136                 glTexCoord2f(0.0f, 1.0f);       glVertex2f(0, 0);
00137                 glTexCoord2f(0.0f, 0.0f);       glVertex2f(0,glutGet(GLUT_WINDOW_HEIGHT));
00138                 glTexCoord2f(1.0f, 0.0f);       glVertex2f(glutGet(GLUT_WINDOW_WIDTH),glutGet(GLUT_WINDOW_HEIGHT));
00139                 glTexCoord2f(1.0f, 1.0f);       glVertex2f(glutGet(GLUT_WINDOW_WIDTH), 0);
00140     glEnd();    
00141         
00142         glDisable(GL_BLEND);
00143         glDisable(GL_TEXTURE_2D);
00144         glEnable(GL_DEPTH_TEST);
00145         
00146         /*
00147         if(m_ShowRegion)
00148         {
00149                 int i=0;
00150                 for(m_ItVecActionCommand=m_VecActionCommand.begin();m_ItVecActionCommand!=m_VecActionCommand.end();m_ItVecActionCommand++,i++)
00151                 {
00152                         
00153                         double Xup,Yup,Xdo,Ydo,cofx=1,cofy=1;
00154                         //Xup=((double)m_ItVecActionCommand->m_MouseXup/m_DefaultResolutionX)*ManagerWindow->GetResolutionX();
00155                         //Yup=((double)m_ItVecActionCommand->m_MouseYup/m_DefaultResolutionY)*ManagerWindow->GetResolutionY();
00156                         //Xdo=((double)m_ItVecActionCommand->m_MouseXdown/m_DefaultResolutionX)*ManagerWindow->GetResolutionX();
00157                         //Ydo=((double)m_ItVecActionCommand->m_MouseYdown/m_DefaultResolutionY)*ManagerWindow->GetResolutionY();
00158                         
00159                         
00160                         
00161                         //cout<<"Current resolution X:"<<ManagerWindow->GetResolutionX()<<endl;
00162                         //cout<<"Current resolution Y:"<<ManagerWindow->GetResolutionY()<<endl;
00163                         //cout<<"Default X:"<<m_DefaultResolutionX<<endl;
00164                         //cout<<"Default Y:"<<m_DefaultResolutionY<<endl;
00165                         if(cofx==0)cofx=1;
00166                         if(cofy==0)cofy=1;
00167                         cofx=(ManagerWindow->GetResolutionX()/m_DefaultResolutionX);            
00168                         cofy=(ManagerWindow->GetResolutionY()/m_DefaultResolutionY);
00169                         //cout<<"cofx :"<<cofx<<endl;
00170                         //cout<<"cofy :"<<cofy<<endl;
00171                         
00172 
00173                         
00174                         
00175                         Xup=(m_ItVecActionCommand->m_MouseXup)*cofx;
00176                         Yup=(m_ItVecActionCommand->m_MouseYup)*cofy;
00177                         Xdo=(m_ItVecActionCommand->m_MouseXdown)*cofx;
00178                         Ydo=(m_ItVecActionCommand->m_MouseYdown)*cofy;
00179                         
00180                         if(i%1==0){glColor3f((float)i/10,1.0f-((float)i/10),1.0f);}
00181                         if(i%2==0){glColor3f(1.0f,1.0f-((float)i/10),(float)1/10);}
00182                         if(i%3==0){glColor3f(1.0f-((float)i/10),1.0f,(float)1/10);}
00183                         glBegin(GL_LINE_LOOP);
00184                                 glVertex2f(Xdo,Ydo);
00185                                 glVertex2f(Xdo,Yup);
00186                                 glVertex2f(Xup,Yup);
00187                                 glVertex2f(Xup,Ydo);
00188                         glEnd();
00189                 }
00190         }
00191         glEnable(GL_LIGHTING);*/
00192         ExNihilo::LeaveOrthoMode();
00193         glPopMatrix();
00194 UnGuard
00195 }

void EnableInterface void    [inline]
 

Définition à la ligne 86 du fichier ExCInterface.h.

Références m_State.

00086 {m_State=false;}

bool GetInterfaceState void    [inline]
 

Définition à la ligne 87 du fichier ExCInterface.h.

Références m_State.

00087 {m_State=true;}

int GetNumInterface void    [inline]
 

Définition à la ligne 81 du fichier ExCInterface.h.

Références m_NumInterface.

00081 {m_NumInterface=num;}

void HideRegion void    [inline]
 

Définition à la ligne 84 du fichier ExCInterface.h.

Références m_ShowRegion.

Référencé par ExManagerInterface::HideRegion().

00084 {m_ShowRegion=true;}

ExCAction InputCommand int    command,
int    mousex,
int    mousey
 

Définition à la ligne 197 du fichier ExCInterface.cpp.

Références ExManagerWindow::GetResolutionX(), ExManagerWindow::GetResolutionY(), Guard, InputCommand(), ExCAction::m_Action, m_ItVecActionCommand, ExCAction::m_NextAction, m_VecActionCommand, ManagerWindow, et ExCAction::SetParam().

Référencé par InputCommand().

00198 {
00199 Guard(ExCAction ExCInterface::InputCommand(int command,int mousex,int mousey))
00200         int CntAct=0;
00201         ExCAction RetAct;
00202         
00203         for(m_ItVecActionCommand=m_VecActionCommand.begin();m_ItVecActionCommand!=m_VecActionCommand.end();m_ItVecActionCommand++)
00204         {
00205                 if(m_ItVecActionCommand->m_Command==command)
00206                 {
00207                         if(m_ItVecActionCommand->m_MouseXup<0)
00208                         {
00209                                 if(CntAct>0)
00210                                 {
00211                                         ExCAction       *RecursifActA;
00212                                         ExCAction       *RecursifActB;
00213                                         RecursifActA=&RetAct;
00214                                         for(int i=0;i<CntAct;i++)
00215                                         {
00216                                                 if(RecursifActA->m_NextAction==NULL)
00217                                                 {
00218                                                         RecursifActA->m_NextAction=new ExCAction;
00219                                                         RecursifActB=RecursifActA->m_NextAction;
00220                                                         RecursifActB->m_Action=m_ItVecActionCommand->m_Action;
00221                                                         RecursifActB->SetParam(m_ItVecActionCommand->m_Param);
00222                                                 }
00223                                                 RecursifActA=RecursifActA->m_NextAction;
00224                                         }
00225                                         CntAct++;
00226                                 }else
00227                                 {
00228                                         RetAct.m_Action=m_ItVecActionCommand->m_Action;
00229                                         RetAct.SetParam(m_ItVecActionCommand->m_Param);
00230                                         CntAct++;
00231                                 }
00232                         }else
00233                         {
00234                                 double Xup,Yup,Xdo,Ydo,Mx,My;
00235                                 Xup=((double)m_ItVecActionCommand->m_MouseXup/ManagerWindow->GetResolutionX());
00236                                 Yup=((double)m_ItVecActionCommand->m_MouseYup/ManagerWindow->GetResolutionY());
00237                                 Xdo=((double)m_ItVecActionCommand->m_MouseXdown/ManagerWindow->GetResolutionX());
00238                                 Ydo=((double)m_ItVecActionCommand->m_MouseYdown/ManagerWindow->GetResolutionY());
00239                                 Mx=((double)mousex/ManagerWindow->GetResolutionX());
00240                                 My=((double)mousey/ManagerWindow->GetResolutionY());
00241 
00242                                 /*cout<<"Resolution "<<ManagerWindow->GetResolutionX()<<" "<<ManagerWindow->GetResolutionY()<<endl;
00243                                 cout<<"Xup :"<<Xup<<endl;
00244                                 cout<<"Yup :"<<Yup<<endl;
00245                                 cout<<"Xdo :"<<Xdo<<endl;
00246                                 cout<<"Ydo :"<<Ydo<<endl;
00247                                 cout<<"Mx  :"<<Mx<<endl;
00248                                 cout<<"My  :"<<My<<endl;
00249                                 */
00250                                 
00251                                 if((Xup>Mx)&&(Xdo<Mx)&&(Ydo<My)&&(Yup>My))
00252                                 {
00253                                         std::cout<<"clik dedans"<<std::endl;
00254                                         if(CntAct>0)
00255                                         {
00256                                                 ExCAction       *RecursifActA;
00257                                                 ExCAction       *RecursifActB;
00258                                                 RecursifActA=&RetAct;
00259                                                 for(int i=0;i<CntAct;i++)
00260                                                 {
00261                                                         if(RecursifActA->m_NextAction==NULL)
00262                                                         {
00263                                                                 RecursifActA->m_NextAction=new ExCAction;
00264                                                                 RecursifActB=RecursifActA->m_NextAction;
00265                                                                 RecursifActB->m_Action=m_ItVecActionCommand->m_Action;
00266                                                                 RecursifActB->SetParam(m_ItVecActionCommand->m_Param);
00267                                                         }
00268                                                         RecursifActA=RecursifActA->m_NextAction;
00269                                                 }
00270                                                 CntAct++;
00271                                         }else
00272                                         {
00273                                                 RetAct.m_Action=m_ItVecActionCommand->m_Action;
00274                                                 RetAct.SetParam(m_ItVecActionCommand->m_Param);
00275                                                 CntAct++;
00276                                         }
00277                                 }else
00278                                 {
00279                                         std::cout<<"click hors coordonée"<<std::endl;
00280                                 }
00281                         }
00282                 }
00283         }
00284         if(CntAct==0)
00285         {
00286                 RetAct.m_Action=NOTHING;
00287                 RetAct.SetParam("NULL");
00288         }
00289 
00290         return RetAct;
00291 UnGuard
00292 }

bool LoadFile std::string    FileName [virtual]
 

Redéfinie à partir de ExCObject.

Définition à la ligne 51 du fichier ExCInterface.cpp.

Références ExManagerTexture::Add(), ExNihilo::ExtractIntValueFromSring(), ExNihilo::ExtracValueFromSring(), Guard, LoadFile(), ActionCommand::m_Action, ActionCommand::m_Command, m_DefaultResolutionX, m_DefaultResolutionY, ActionCommand::m_MouseXdown, ActionCommand::m_MouseXup, ActionCommand::m_MouseYdown, ActionCommand::m_MouseYup, ActionCommand::m_Param, m_Texture, m_TextureMask, m_VecActionCommand, ManagerTexture, et PREFIX.

Référencé par ExCInterface(), ExManagerInterface::Load(), et LoadFile().

00052 {
00053 Guard(bool ExCInterface::LoadFile(std::string FileName))
00054         char                    buffer[255];
00055 #ifdef UNIX_SRC
00056         sprintf(buffer, PREFIX "/ExNihilo/Data/Interface/%s", FileName.data());
00057 #else
00058         sprintf(buffer, "../Data/Interface/%s", FileName.data());
00059 #endif
00060         std::ifstream fin;
00061         std::string buffstring;
00062         char b[256];
00063         fin.open(buffer,std::ios::in);
00064         if(fin.is_open())
00065         {
00066                 try
00067                 {
00068                         //----Read image
00069                         memset(b,0,255);
00070                         fin.getline(b,256,'\n');
00071                         m_Texture=ExNihilo::ExtracValueFromSring(b,"<Image>","<#Image>");
00072                         //----Read mask
00073             memset(b,0,255);
00074                         fin.getline(b,256,'\n');                        
00075                         m_TextureMask=ExNihilo::ExtracValueFromSring(b,"<Mask>","<#Mask>");
00076                         //----Read resolution
00077             memset(b,0,255);
00078                         fin.getline(b,256,'\n');                        
00079                         buffstring=ExNihilo::ExtracValueFromSring(b,"<Mask>","<#Mask>");
00080                         m_DefaultResolutionX=ExNihilo::ExtractIntValueFromSring(buffstring,"<X>","<#X>");
00081                         m_DefaultResolutionY=ExNihilo::ExtractIntValueFromSring(buffstring,"<Y>","<#Y>");
00082                         //----Read all command
00083                         do
00084                         {
00085                                 memset(b,0,255);
00086                                 fin.getline(b,256,'\n');
00087                                 try
00088                                 {
00089                                         ActionCommand actcmd;
00090                                         buffstring=ExNihilo::ExtracValueFromSring(b,"<Interface_Action>","<#Interface_Action>");
00091                                         actcmd.m_Action=ExNihilo::ExtractIntValueFromSring(buffstring,"<Action>","<#Action>");
00092                                         actcmd.m_Command=ExNihilo::ExtractIntValueFromSring(buffstring,"<Command>","<#Command>");
00093                                         actcmd.m_Param=ExNihilo::ExtracValueFromSring(buffstring,"<Param>","<#Param>");
00094                                         actcmd.m_MouseXup=ExNihilo::ExtractIntValueFromSring(buffstring,"<TopX>","<#TopX>");
00095                                         actcmd.m_MouseYup=ExNihilo::ExtractIntValueFromSring(buffstring,"<TopY>","<#TopY>");
00096                                         actcmd.m_MouseXdown=ExNihilo::ExtractIntValueFromSring(buffstring,"<BottomX>","<#BottomX>");
00097                                         actcmd.m_MouseYdown=ExNihilo::ExtractIntValueFromSring(buffstring,"<BottomY>","<#BottomY>");
00098                                         m_VecActionCommand.push_back(actcmd);
00099                                 }catch(ExCExpStringNotFound){}
00100                         }while(!fin.eof());
00101                         fin.close();
00102                 }catch(...){throw ExCExpFileReadError();}
00103         }else throw   ExCExpFileNotFound();
00104         ManagerTexture->Add(m_Texture);
00105         ManagerTexture->Add(m_TextureMask);
00106         return true;
00107 UnGuard
00108 }

void SetManagerTexture ExManagerTexture   Texture [inline]
 

Définition à la ligne 78 du fichier ExCInterface.h.

Références ManagerWindow.

Référencé par ExManagerInterface::Load().

00078 {ManagerWindow = Window;}

void SetManagerWindow ExManagerWindow   Window [inline]
 

Définition à la ligne 77 du fichier ExCInterface.h.

00078 {ManagerWindow = Window;}

void SetNumInterface int    num [inline]
 

Définition à la ligne 80 du fichier ExCInterface.h.

00081 {m_NumInterface=num;}

void ShowRegion void    [inline]
 

Définition à la ligne 83 du fichier ExCInterface.h.

Référencé par ExManagerInterface::ShowRegion().

00084 {m_ShowRegion=true;}


Documentation des données imbriquées

std::ostrstream* Consol
 

Définition à la ligne 68 du fichier ExCInterface.h.

Référencé par ExManagerInterface::Load().

int m_DefaultResolutionX [private]
 

Définition à la ligne 49 du fichier ExCInterface.h.

Référencé par LoadFile().

int m_DefaultResolutionY [private]
 

Définition à la ligne 50 du fichier ExCInterface.h.

Référencé par LoadFile().

std::vector<ActionCommand>::iterator m_ItVecActionCommand [private]
 

Définition à la ligne 65 du fichier ExCInterface.h.

Référencé par InputCommand().

int m_NumInterface [private]
 

Définition à la ligne 48 du fichier ExCInterface.h.

Référencé par GetNumInterface().

bool m_ShowRegion [private]
 

Définition à la ligne 51 du fichier ExCInterface.h.

Référencé par DisableInterface(), ExCInterface(), et HideRegion().

bool m_State [private]
 

Définition à la ligne 52 du fichier ExCInterface.h.

Référencé par EnableInterface(), ExCInterface(), et GetInterfaceState().

std::string m_Texture [private]
 

Définition à la ligne 46 du fichier ExCInterface.h.

Référencé par Draw(), et LoadFile().

std::string m_TextureMask [private]
 

Définition à la ligne 47 du fichier ExCInterface.h.

Référencé par Draw(), et LoadFile().

std::vector<ActionCommand> m_VecActionCommand [private]
 

Définition à la ligne 64 du fichier ExCInterface.h.

Référencé par InputCommand(), et LoadFile().

ExManagerTexture* ManagerTexture [private]
 

Définition à la ligne 45 du fichier ExCInterface.h.

Référencé par Draw(), et LoadFile().

ExManagerWindow* ManagerWindow [private]
 

Définition à la ligne 44 du fichier ExCInterface.h.

Référencé par InputCommand().


La documentation associée à cette classe a été générée à partir des fichiers suivants :
Généré le Tue Dec 10 18:18:25 2002 pour ExNihilo par doxygen1.3-rc1