Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Shared objects between windows

$
0
0

@pxt wrote:

Hello! im following the multi window example, creating two apps for two different windows.
How can i share one object (creating in the ofApp) to the other window? i want to (lets say, for example) click the second window and create a new Object in the main Window.

#include "ofMain.h"
#include "ofApp.h"
#include "GuiApp.h"
#include "ofAppGLFWWindow.h"
#include "radarApp.hpp"


//========================================================================
int main( ){
	ofGLFWWindowSettings settings;

    settings.setSize(600, 600);
	settings.setPosition(ofVec2f(300,0));
	settings.resizable = true;
	shared_ptr<ofAppBaseWindow> mainWindow = ofCreateWindow(settings);

    settings.setSize(300, 800);
	settings.setPosition(ofVec2f(0,0));
	settings.resizable = false;
	shared_ptr<ofAppBaseWindow> guiWindow = ofCreateWindow(settings);
    
    
    
    settings.setSize(500, 500);
    settings.setPosition(ofVec2f(0,0));
    settings.resizable = false;
    shared_ptr<ofAppBaseWindow> radarWindow = ofCreateWindow(settings);


	shared_ptr<ofApp> mainApp(new ofApp);
	shared_ptr<GuiApp> guiApp(new GuiApp);
    shared_ptr<radarApp> radarAppl(new radarApp);


	ofRunApp(guiWindow, guiApp);
	ofRunApp(mainWindow, mainApp);
    ofRunApp(radarWindow, radarAppl);
    
	ofRunMainLoop();

}

this is my main code. in mainAPP i create an object and i want to use it in the radarWindow.

Posts: 7

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles