I have a class in
Game.h:
class Game
{
public:
~Game (){}
bool init(const char* title,int xpos, int ypos, int width, int height,bool fullscreen );
void render();
void update() ;
void handleEvents();
void clean();
void draw();
static Game* Instance();
// a function to acces the private running variable
bool running () {return m_bRunning; }
private:
Game ();
static Game* s_pInstance;
SDL_Window* m_pWindow;
SDL_Renderer* m_pRenderer;
bool m_bRunning;
int m_currentFrame;
};
//create the typedef
typedef Game TheGame;
and also in Game.cpp I have a static variable initialization like the following
Game* Game::s_pInstance = 0;
So I intend to know why I need to use (Game*
) variable type in here and is it a must?