SFML community forums
Help => Window => Topic started by: devonrevenge on December 16, 2015, 07:50:13 pm
-
I have been practicing making simpler programs but im now attempting to make myself a few experimental gui functions.
Presently if I wanted to create a new window object each time something like a message window popped up I have passed a RenderWindow object as a reference into a function and changed its state again when I needed something else, this requires something like a static object for use in main, I dont really like this, I would like to create a window from within an onject and just call a show window function within it.
What is the popular way of doing something like this, I like to keep my main method simple and clean and im sure theres better ways especially if I wanted to call several different windows fro m several different threads.
-
You could return std::unique_ptr<sf::RenderWindow> and if you pass it somewhere use a reference. No need for static variables.