Permalink
Browse files

PG: added command line only ifdefs

  • Loading branch information...
1 parent 1fa84a5 commit 388b0d766b8e54fb14ea287d8c5fbecfdef339ce @arturoc arturoc committed May 4, 2012
Showing with 33 additions and 4 deletions.
  1. +23 −0 apps/devApps/projectGenerator/src/testApp.cpp
  2. +10 −4 apps/devApps/projectGenerator/src/testApp.h
View
23 apps/devApps/projectGenerator/src/testApp.cpp
@@ -41,6 +41,8 @@ void testApp::setup(){
std::exit(0);
}
+
+#ifndef COMMAND_LINE_ONLY
panelAddons.setup();
ofDirectory addons(ofFilePath::join(getOFRoot(),"addons"));
addons.listDir();
@@ -77,6 +79,9 @@ void testApp::setup(){
ofSetVerticalSync(true);
ofEnableAlphaBlending();
ofSetFrameRate(60);
+#else
+ std::exit(0);
+#endif
}
void testApp::setupForTarget(int targ){
@@ -117,6 +122,7 @@ void testApp::setupForTarget(int targ){
void testApp::generateExamplesCB(bool & pressed){
+#ifndef COMMAND_LINE_ONLY
if (pressed == false) return; // don't do this again on the mouseup.
targetsToMake.clear();
@@ -138,6 +144,8 @@ void testApp::generateExamplesCB(bool & pressed){
int target = ofGetTargetPlatform();
setupForTarget(target);
+#endif
+
}
void testApp::generateExamples(){
@@ -192,6 +200,8 @@ void testApp::generateExamples(){
}
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?
@@ -229,9 +239,13 @@ ofFileDialogResult testApp::makeNewProjectViaDialog(){
}
}
return res;
+#endif
+
}
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?
@@ -272,6 +286,8 @@ ofFileDialogResult testApp::updateProjectViaDialog(){
}
return res;
+#endif
+
}
void testApp::createProjectPressed(bool & pressed){
@@ -318,6 +334,7 @@ void testApp::update(){
//--------------------------------------------------------------
void testApp::draw(){
+#ifndef COMMAND_LINE_ONLY
//ofBackgroundGradient(ofColor::gray,ofColor::black);
panelAddons.draw();
@@ -331,6 +348,8 @@ void testApp::draw(){
/*ofDrawBitmapString("press 'm' to make all files\npress ' ' to make a specific file", ofPoint(30,30));*/
ofSetColor(255);
ofDrawBitmapString(drawableOfPath, ofPathDrawPoint);
+#endif
+
}
//--------------------------------------------------------------
@@ -393,6 +412,8 @@ void testApp::dragEvent(ofDragInfo dragInfo){
//--------------------------------------------------------------
void testApp::setupDrawableOFPath(){
+
+#ifndef COMMAND_LINE_ONLY
vector<string> subdirs = ofSplitString("OF path: " + getOFRoot(), "/");
int textLength = 0;
int padding = 5;
@@ -429,5 +450,7 @@ void testApp::setupDrawableOFPath(){
panelAddons.setPosition(panelAddons.getPosition().x, ofPathRect.y + ofPathRect.height + padding);
examplesPanel.setPosition(examplesPanel.getPosition().x, ofPathRect.y + ofPathRect.height + padding);
+#endif
+
}
View
14 apps/devApps/projectGenerator/src/testApp.h
@@ -1,12 +1,17 @@
#pragma once
+//#define COMMAND_LINE_ONLY
+
#include "ofMain.h"
#include "CBLinuxProject.h"
#include "CBWinProject.h"
#include "visualStudioProject.h"
#include "xcodeProject.h"
#include <Poco/Path.h>
+
+#ifndef COMMAND_LINE_ONLY
#include "ofxGui.h"
+#endif
class testApp : public ofBaseApp{
@@ -43,7 +48,10 @@ class testApp : public ofBaseApp{
string projectPath;
string target;
-
+ vector <int> targetsToMake;
+ bool buildAllExamples;
+
+#ifndef COMMAND_LINE_ONLY
string drawableOfPath;
ofRectangle ofPathRect;
ofPoint ofPathDrawPoint;
@@ -54,7 +62,5 @@ class testApp : public ofBaseApp{
ofxPanel examplesPanel;
ofxToggle osxToggle, iosToggle, wincbToggle, winvsToggle, linuxcbToggle, linux64cbToggle;
ofxButton generateButton;
-
- vector <int> targetsToMake;
- bool buildAllExamples;
+#endif
};

0 comments on commit 388b0d7

Please sign in to comment.