SFML Window Problem

So, I'm learning SFML (done with SDL, just not for me) and I've run into a very minor problem.

So, if I have a function called init() that handles creating the window and setting up openGL, whenever init finishes, the window closes. Simply put, I would like to store all of my initialization code in a function (obviously for organization and pretty-ness) but need the Window to stay open after init() is finished and a loop is started.

Any help?
I'm guessing that you're creating an instance of sf::RenderWindow (or whatever you're using) in the init() function... If that's the case, make it global and call the create() function for the window object in the init() function. That way the scope of the window doesn't end when init() finishes.
Sorry, I rushed and didn't write all the details in :X

You are correct though on my implementation.

Even if I make the window global and then create an instance of it in init(), I still have the issue.

Maybe a short example or a link in the right direction?

EDIT: Never mind, I made a very foolish mistake, but have resolved my problem. Thank you ModShop for your help!
Last edited on
Topic archived. No new replies allowed.