void testApp::generateExamplesCB(bool & pressed){ #ifndef COMMAND_LINE_ONLY if (pressed == false) return; // don't do this again on the mouseup. targetsToMake.clear(); if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX); if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE); if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC); if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS); if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX); if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64); if( targetsToMake.size() == 0 ){ cout << "Error: generateExamplesCB - must specifiy a project to generate " <<endl; } for(int i = 0; i < (int)targetsToMake.size(); i++){ setupForTarget(targetsToMake[i]); generateExamples(); } int target = ofGetTargetPlatform(); setupForTarget(target); #endif }
void testApp::generateExamplesCB(bool & pressed){ vector <int> targetsToMake; if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX); if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE); if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC); if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS); if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX); if( targetsToMake.size() == 0 ){ cout << "Error: generateExamplesCB - must specifiy a project to generate " <<endl; } for(int i = 0; i < (int)targetsToMake.size(); i++){ setupForTarget(targetsToMake[i]); generateExamples(); } int target = ofGetTargetPlatform(); setupForTarget(target); }
ofFileDialogResult testApp::updateProjectViaDialog(){ #ifndef COMMAND_LINE_ONLY ofFileDialogResult res = ofSystemLoadDialog("choose a folder to update an OF project :)",true); if (res.fileName == "" || res.filePath == "") return res; //base.pushDirectory(res.fileName); // somehow an extra things here helps? vector <int> targetsToMake; if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX); if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE); if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC); if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS); if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX); if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64); if( targetsToMake.size() == 0 ){ cout << "Error: updateProjectViaDialog - must specifiy a project to generate " <<endl; ofSystemAlertDialog("Error: updateProjectViaDialog - must specifiy a project platform to generate"); } for(int i = 0; i < (int)targetsToMake.size(); i++){ setupForTarget(targetsToMake[i]); project->setup(target); project->create(res.filePath); vector<string> addonsToggles = panelAddons.getControlNames(); for (int i = 0; i < (int)addonsToggles.size(); i++){ ofxToggle toggle = panelAddons.getToggle(addonsToggles[i]); // TODO: make this remove existing addons that are unchecked???? // probably requires a more complex logic chain: loadProject // (ticks the addons) and then you can untick etc??? if(toggle){ ofAddon addon; addon.pathToOF = getOFRelPath(res.filePath); addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addonsToggles[i]),target); printf("adding %s addons \n", addonsToggles[i].c_str()); project->addAddon(addon); } } project->save(true); } return res; #endif }
ofFileDialogResult testApp::makeNewProjectViaDialog(){ #ifndef COMMAND_LINE_ONLY ofFileDialogResult res = ofSystemSaveDialog("newProjectName", "choose a folder for a new OF project :)"); if (res.fileName == "" || res.filePath == "") return res; //base.pushDirectory(res.fileName); // somehow an extra things here helps? vector <int> targetsToMake; if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX); if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE); if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC); if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS); if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX); if( linux64cbToggle ) targetsToMake.push_back(OF_TARGET_LINUX64); if( targetsToMake.size() == 0 ){ cout << "Error: makeNewProjectViaDialog - must specifiy a project to generate " <<endl; ofSystemAlertDialog("Error: makeNewProjectViaDialog - must specifiy a project platform to generate"); } for(int i = 0; i < (int)targetsToMake.size(); i++){ setupForTarget(targetsToMake[i]); project->setup(target); if(project->create(res.filePath)){ vector<string> addonsToggles = panelAddons.getControlNames(); for (int i = 0; i < (int) addonsToggles.size(); i++){ ofxToggle toggle = panelAddons.getToggle(addonsToggles[i]); if(toggle){ ofAddon addon; addon.pathToOF = getOFRelPath(res.filePath); addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addonsToggles[i]),target); printf("adding %s addons \n", addonsToggles[i].c_str()); project->addAddon(addon); } } project->save(true); } } return res; #endif }
void testApp::generateProject(){ vector <int> targetsToMake; if( osxToggle ) targetsToMake.push_back(OF_TARGET_OSX); if( iosToggle ) targetsToMake.push_back(OF_TARGET_IPHONE); if( wincbToggle ) targetsToMake.push_back(OF_TARGET_WINGCC); if( winvsToggle ) targetsToMake.push_back(OF_TARGET_WINVS); if( linuxcbToggle ) targetsToMake.push_back(OF_TARGET_LINUX); targetsToMake.push_back(OF_TARGET_LINUX64); if( targetsToMake.size() == 0 ){ cout << "Error: makeNewProjectViaDialog - must specifiy a project to generate " <<endl; ofSystemAlertDialog("Error: makeNewProjectViaDialog - must specifiy a project platform to generate"); return; } if (buttons[0].myText.size() == 0){ ofSystemAlertDialog("Error: project must have a name"); return; } printf("start with project generation \n"); string path = ofFilePath::join(buttons[1].myText, buttons[0].myText); for(int i = 0; i < (int)targetsToMake.size(); i++){ string target = setupForTarget(targetsToMake[i]); if(project->create(path)){ vector<string> addonsToggles = panelCoreAddons.getControlNames(); for (int i = 0; i < (int) addonsToggles.size(); i++){ ofxToggle toggle = panelCoreAddons.getToggle(addonsToggles[i]); if(toggle){ ofAddon addon; addon.pathToOF = getOFRelPath(path); addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target); project->addAddon(addon); } } addonsToggles = panelOtherAddons.getControlNames(); for (int i = 0; i < (int) addonsToggles.size(); i++){ ofxToggle toggle = panelOtherAddons.getToggle(addonsToggles[i]); if(toggle){ ofAddon addon; addon.pathToOF = getOFRelPath(path); cout << getOFRelPath(path) << " " << path << endl; addon.fromFS(ofFilePath::join(addonsPath, addonsToggles[i]),target); project->addAddon(addon); } } project->save(true); } } printf("done with project generation \n"); setStatus("generated: " + buttons[1].myText + "/" + buttons[0].myText); // go through the control panels, do stuff }
//-------------------------------------------------------------- void testApp::setup(){ //ofSetLogLevel(OF_LOG_NOTICE); project = NULL; while(!checkConfigExists()){ askOFRoot(); } setOFRoot(getOFRootFromConfig()); setupDrawableOFPath(); int targ = ofGetTargetPlatform(); //plat = OF_TARGET_IPHONE; setupForTarget(targ); if(projectPath!="" || buildAllExamples){ for(int i = 0; i < (int)targetsToMake.size(); i++){ setupForTarget(targetsToMake[i]); if(buildAllExamples){ generateExamples(); }else{ project->setup(target); project->create(projectPath); vector < string > addons; parseAddonsDotMake(project->getPath() + "addons.make", addons); for (int i = 0; i < (int)addons.size(); i++){ ofAddon addon; addon.fromFS(ofFilePath::join(ofFilePath::join(getOFRoot(), "addons"), addons[i]),target); project->addAddon(addon); } project->save(false); } } std::exit(0); } #ifndef COMMAND_LINE_ONLY panelAddons.setup(); ofDirectory addons(ofFilePath::join(getOFRoot(),"addons")); addons.listDir(); for(int i=0;i<(int)addons.size();i++){ string addon = addons.getName(i); if(addon.find("ofx")==0){ ofxToggle * toggle = new ofxToggle(); panelAddons.add(toggle->setup(addon,false,300)); } } panelOptions.setup("","settings.xml",ofGetWidth()-panelAddons.getWidth()-10,120); panelOptions.add(createProject.setup("create project",300)); panelOptions.add(updateProject.setup("update project",300)); panelOptions.add(createAndOpen.setup("create and open project",300)); panelOptions.add(changeOFRoot.setup("change OF path",300)); createProject.addListener(this,&testApp::createProjectPressed); updateProject.addListener(this,&testApp::updateProjectPressed); createAndOpen.addListener(this,&testApp::createAndOpenPressed); changeOFRoot.addListener(this,&testApp::changeOFRootPressed); examplesPanel.setup("generate examples", "examples.xml", 400, 10); examplesPanel.add(generateButton.setup("<--Generate")); examplesPanel.add(wincbToggle.setup("win CB projects",ofGetTargetPlatform()==OF_TARGET_WINGCC)); examplesPanel.add(winvsToggle.setup("win VS projects", ofGetTargetPlatform()==OF_TARGET_WINVS)); examplesPanel.add(linuxcbToggle.setup("linux CB projects",ofGetTargetPlatform()==OF_TARGET_LINUX)); examplesPanel.add(linux64cbToggle.setup("linux64 CB projects",ofGetTargetPlatform()==OF_TARGET_LINUX64)); examplesPanel.add(osxToggle.setup("osx projects",ofGetTargetPlatform()==OF_TARGET_OSX)); examplesPanel.add(iosToggle.setup("ios projects",ofGetTargetPlatform()==OF_TARGET_IPHONE)); generateButton.addListener(this,&testApp::generateExamplesCB); ofSetVerticalSync(true); ofEnableAlphaBlending(); ofSetFrameRate(60); #else std::exit(0); #endif }