J'ai suivi le tuto :
CGameState.h
#ifndef __SFML_Gamestates__CGameState__
#define __SFML_Gamestates__CGameState__
#include <iostream>
class CGameEngine;
class CGameState
{
public:
virtual void Init() = 0;
virtual void Cleanup() = 0;
virtual void Pause() = 0;
virtual void Resume() = 0;
virtual void HandleEvents(CGameEngine* game) = 0;
virtual void Update(CGameEngine* game) = 0;
virtual void Draw(CGameEngine* game) = 0;
void ChangeState(CGameEngine* game,
CGameState* state) {
game->ChangeState(state);
}
protected: CGameState() { }
};
#endif /* defined(__SFML_Gamestates__CGameState__) */
CGameEngine.h
#ifndef SFML_Gamestates_CGameEngine_h
#define SFML_Gamestates_CGameEngine_h
#include <iosstream>
#include "CGameState.h"
class CGameEngine
{
public:
void Init();
void Cleanup();
void ChangeState(CGameState* state);
void PushState(CGameState* state);
void PopState();
void HandleEvents();
void Update();
void Draw();
bool Running() { return m_running; }
void Quit() { m_running = false; }
private:
// the stack of states
vector<CGameState*> states;
bool m_running;
};
#endif
CGameIntro.h
#ifndef __SFML_Gamestates__CGameIntro__
#define __SFML_Gamestates__CGameIntro__
#include <iostream>
#include "CGameState.h"
class CGameEngine;
class CGameIntro : public CGameState
{
public:
virtual void Init() ;
virtual void Cleanup() ;
virtual void Pause() ;
virtual void Resume() ;
virtual void HandleEvents(CGameEngine* game) ;
virtual void Update(CGameEngine* game) ;
virtual void Draw(CGameEngine* game) ;
};
#endif /* defined(__SFML_Gamestates__CGameIntro__) */
CGameIntro.cpp
#include "CGameIntro.h"
void Init()
{
}
void Cleanup()
{
}
void Pause()
{
}
void Resume()
{
}
void HandleEvents(CGameEngine* game)
{
}
void Update(CGameEngine* game)
{
}
void Draw(CGameEngine* game)
{
}
Dans le CGameState.h j'ai une erreur ici
game->ChangeState(state);
http://prntscr.com/2ptanq