I saw that it’s possible to set a window visibility to “false” in “ofGLFWWindowSettings settings”. It’s the only place i’ve found this option. Is it possible to give an already created “shared_ptr” a new "“ofGLFWWindowSettings settings”. My intention is to create both windows at startup and just hide/show my pop-up window when needed. Would be more simple i think.
I want to disable access to my main window as long as my pop up window is active. I can think of 3 ways to do that but i wasnt able to figure out how to code any of them…
I could force my pop up window to remain my “current window” as long as its opened.
I could disable all listeners on my main window, including the ones linked to “ofxButtons”, “ofxSliders”, etc.
I could completely hide my main window for as long as my pop up window is active.
I start my main window in my “main.cpp”, but my second window from another object. I was able to pass the “shared_ptr” created in my main from an object to another to test your solution. But by doing so i created a lot of extra dependencies.
When running “ofRunApp(editorWindow, mainEditorSharedPtr)”, editorWindow must be stored somewhere. Is there a way to access that “somewhere”?
Also, lets say i create my second window with this line:
If i use “ofGetCurrentWindow()->setWindowShouldClose();” to close that second window, do you know if all trace of it is deleted from memory? Like if i open/close this window multiple time, am i creating a small memory leak? I’ve tried to follow the of source code to find an answer, but it’s not the easiest to follow, nor the most well documented ive seen…
I think the previous answer applies as well.
As editorWindow is a shared_ptr you can have it in several different places and in all it will point to the same window.
If you use ofGetCurrentWindow it is a bit uncertain which is the current window, so I think that you should simply store resulting shared_ptr somewhere in your class.
There are no leaks if you open/close several windows, so far that you manage properly the shared_ptrs. (mostly avoid circular reeference). Besides that it will destroy properly and invalidate the shared_pointers, if any.
In the code you posted you used the new keyword and you did not delete that properly, which will give you a memory leak.
The easiet way I think is to use unique_ptr which ill dealocate properly upon its destruction.