salut
je suis en train de faire un fps avec Irrlicht
mais j'ai un problème avec mon code pour afficher les différent ecan du jeu .

je fais :

main.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
 
#include "classe.h"
#include "intro.h"
 
 
int main()
{
   CGameEngine game;
   game.init();
 
   intro intros;
   intros.init(game);
   game.push(intros);
 
 
   // load the intro
   //game.ChangeState( CIntroState::Instance() );
 
   // main loop
   while ( game.run() )
   {
     game.begin();
     //game.Update();
     game.draw();
     game.end();
   }
 
   // cleanup the engine
   game.clean();
 
return 0;
}
classe.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
 
#ifndef CLASSE_H_INCLUDED
#define CLASSE_H_INCLUDED
 
#include <IRR/irrlicht.h>
#include <string>
#include <vector>
#include "CGameState.h"
 
 
using namespace irr;
using namespace std;
 
class CGameEngine
{
    public:
        void init();
        bool run();
        void clean();
        void quit();
        void draw();
        void begin();
        void end();
        void push(CGameState* g);
        scene::ISceneManager* getScen();
 
    private :
        vector < CGameState* > states;
        IrrlichtDevice *device;
        video::IVideoDriver* driver;
        scene::ISceneManager *scenegraph;
        bool running;
        int state;
};
 
 
#endif // CLASSE_H_INCLUDED
classe.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 
#include "classe.h"
 
void CGameEngine::init()
{
    device = createDevice (video::EDT_OPENGL, core::dimension2d<irr::s32>(800,600),32,false,true,false,0);
    driver = device->getVideoDriver ();
    scenegraph = device->getSceneManager ();
 
    device->setWindowCaption(L"Jgame");
 
    running=true;
    state=0;
}
bool CGameEngine::run()
{
    return running;
}
void CGameEngine::clean()
{
    device->drop ();
}
void CGameEngine::quit()
{
    running=false;
}
void CGameEngine::draw()
{
    states[state].draw();
}
void CGameEngine::begin()
{
    driver->beginScene (true, true, video::SColor (255,255,255,255));
}
void CGameEngine::end()
{
    driver->endScene ();
}
scene::ISceneManager* CGameEngine::getScen()
{
return scenegraph;
}
void CGameEngine::push(CGameState* g)
{
    states.push_back(g);
}
CGameState.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
#ifndef CGAMESTATE_H_INCLUDED
#define CGAMESTATE_H_INCLUDED
 
#include <IRR/irrlicht.h>
#include <string>
#include <vector>
#include "classe.h"
 
class CGameState
{
   virtual void draw();
};
 
#endif // CGAMESTATE_H_INCLUDED
intro.h
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 
#ifndef INTRO_H_INCLUDED
#define INTRO_H_INCLUDED
 
#include "classe.h"
#include "CGameState.h"
 
 
class intro :public CGameState
{
    public :
        void init(CGameEngine g);
        void draw();
    private :
        CGameEngine game;
};
 
 
#endif // INTRO_H_INCLUDED
intro.cpp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
#include "intro.h"
 
void intro::init(CGameEngine g)
{
    game=g;
}
void draw()
{
    game.getScen()->drawAll ();
}
pourquoi sa me met un erreur ici :
states[state].draw();
c'est la ligne 28 de classe.cpp

faut faire comment pour afficher l'erreur retourner par le compilateur ?(code block me l'affiche pas )

merci