my problem is ive scrapped all the sdl code and replaced it wil similar SFML code just to get things rolling , but im having issues with the pointer to the main renderwindow in the gameEngine class , specifically how would i declare it as public in the header file and initialize it in the cpp file ?
my header looks like this(simplified)
class CGameState;
class CGameEngine
{
public:
void Init(const char* title, int width=800, int height=600, bool fullscreen=false);
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; }
sf::RenderWindow* window;
private:
};
and my cpp init()
void CGameEngine::Init(const char* title, int width, int height, bool fullscreen)
{
// initialize
window->Create(sf::VideoMode(width, height),title);
window->SetFramerateLimit(60);
m_fullscreen = fullscreen;
m_running = true;
printf("CGameEngine Init\n");
}
the way i tried to create the renderwindow there fails , it should just be
sf::RenderWindow window(ect , ect);
but i cant do
sf::RenderWindow * window(ect);
or sf::RenderWindow window(ect);
because those give errors as well . so im wondering how could i initialize this in the cpp while keeping the simple declaration in the .h so i can access it from other classes by doing game->window ? or is there a better way ? as you can tell i haven't used pointers very much .anyway thanks for reading.
EDIT-----
is there even a need for the renderwindow to be a pointer , i don't mean now specifically but later on ?
i would just do window = new sf::RenderWindow(ect); wouldnt i :\ , and reason for pointer would be so the object doesn't get deleted ? damn its been a while since ive touched c++.