Esempio n. 1
0
//--------------------------------------------------------------
void captureApp::keyPressed(int key) {
	if(key == 'f') {
		ofToggleFullscreen();
	}
	if(key == '\t') {
	
		if( !hidden &&  ofxFileHelper::doesFileExist(capturePrefix+"capture") && ofxFileHelper::doesFileExist(capturePrefix+"capture/0.jpg") ){
			string unique = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds());
			ofxFileHelper::moveFromTo(capturePrefix+"capture", capturePrefix+"savedFolder"+unique);
			ofxFileHelper::makeDirectory(capturePrefix+"capture");
			cameraFrameNum = 0;
		}
	
		hidden = !hidden;
		panel.hidden = hidden;
		if(hidden)
			ofHideCursor();
		else
			ofShowCursor();
		if(!hidden)
			imageSaver.saveAll();
	}
	if(panel.getValueB("frameByFrame") && key == OF_KEY_UP){
		patternFrame--;
	}

	if(panel.getValueB("frameByFrame") && key == OF_KEY_DOWN){
		patternFrame++;
	}
}
Esempio n. 2
0
//--------------------------------------------------
void simpleLogger::log(int logLevel, const char* format, ...){
	//thanks stefan!
	//http://www.ozzu.com/cpp-tutorials/tutorial-writing-custom-printf-wrapper-function-t89166.html

	logRecord record;
	record.year     = ofGetYear();
	record.month    = ofGetMonth();
	record.day      = ofGetDay();
	record.hour     = ofGetHours();
	record.minute   = ofGetMinutes();
	record.seconds  = ofGetSeconds();
	record.level    = logLevel;

	char str[2048] = {0};

	va_list args;
	va_start( args, format );
	vsprintf(str, format, args );
	va_end( args );

	record.msg      = str;
	record.logStr   =  convertToString(record);

	logs.push_back(record);
	logToXml(record);
}
Esempio n. 3
0
//--------------------------------------------------------------
void testApp::keyPressed  (int key){
	if( key == 'r' ){
		bRefresh = true;
	}
	
	if( key == 'c' ){
		string unique = ofToString(ofGetYear()) + ofToString(ofGetMonth()) + ofToString(ofGetDay()) + ofToString(ofGetHours()) + ofToString(ofGetMinutes()) + ofToString(ofGetSeconds());
		ofxFileHelper::copyFromTo("sampleFileDontDelete.txt", "copiedFile"+unique+".txt");
		
		bRefresh = true;
	}
	
	if( key == 'm' ){
		
		if( ofxFileHelper::doesDirectoryExist("dummyFolder/") ){
			//be careful with slashes here - appending a slash when moving a folder will causes mad headaches
			ofxFileHelper::moveFromTo("dummyFolder", "aMovedFolder");
		}else if( ofxFileHelper::doesDirectoryExist("aMovedFolder/") ){
			//be careful with slashes here - appending a slash when moving a folder will causes mad headaches
			ofxFileHelper::moveFromTo("aMovedFolder", "dummyFolder");
		}
		
		bRefresh = true;
	}
}
Esempio n. 4
0
//-------------------------------
void ofxLabGui::saveSettings(string xmlFile){
    for(int i = 0; i < guiObjects.size(); i++)guiObjects[i]->saveSettings(xmlFile);

    for(int i = 0; i < xmlObjects.size(); i++){
        if( xmlObjects[i].guiObj != NULL ){
            int numParams = xmlObjects[i].numParams;

            for(int j = 0; j < numParams; j++){
                string str = xmlObjects[i].xmlName+":val_"+ofToString(j);
                if ( xmlObjects[i].guiObj->dataType == SG_TYPE_STRING){
					settings.setValue(str, xmlObjects[i].guiObj->value.getValueS(j));
				} else {
					settings.setValue(str, xmlObjects[i].guiObj->value.getValueF(j));
				}
            }
        }
    }

    if( incrementSave ){
        string xmlName = incrementSaveName;
        xmlName += ofToString(ofGetYear()) +"-"+ ofToString(ofGetMonth()) +"-"+ ofToString(ofGetDay()) +"-"+ ofToString(ofGetHours()) +"-"+ ofToString(ofGetMinutes())+"-"+ ofToString(ofGetSeconds());
        xmlName += ".xml";
        xmlName = settingsDirectory + xmlName;

        settings.saveFile(xmlName);
    }
	cout<<"SAVING "<<xmlFile;
    settings.saveFile(xmlFile);
    currentXmlFile = xmlFile;
    usingXml = true;
}
void ScreenRecorder::setupNewDirectory()
{
    counter = 0;
    
    string year = ofToString(ofGetYear());
    string month = ofToString(ofGetMonth());
    if (month.size() == 1) month.insert(0, "0");
    string day = ofToString(ofGetDay());
    if (day.size() == 1) day.insert(0, "0");
    string hour = ofToString(ofGetHours());
    if (hour.size() == 1) hour.insert(0, "0");
    string minute = ofToString(ofGetMinutes());
    if (minute.size() == 1) minute.insert(0, "0");
    string second = ofToString(ofGetSeconds());
    if (second.size() == 1) second.insert(0, "0");
    
    currentPath = rootFolderName + "/recording_" + year + "-" + month + "-" + day + "_" + hour + "." + minute + "." + second;
    
    printf("rootFolderName = %s, currentPath = %s \n", rootFolderName.c_str(), currentPath.c_str());
    ofDirectory dir(currentPath);
    if(!dir.exists())
        dir.create(true);
    
    millisAtLastFrame = ofGetElapsedTimeMillis();
}
/* EmergenceLog::dateTimeString
 * Returns the current date/time in following format:
 * 2011-05-26,14-36-587,28.469
 */
string EmergenceLog::fileDateTimeString(float beatTime)
{
    string output = "";
    
    int year = ofGetYear();
    int month = ofGetMonth();
    int day = ofGetDay();
    int hours = ofGetHours();
    int minutes = ofGetMinutes();
    int seconds = ofGetSeconds();
    
    output = output + ofToString(year) + ".";
    if (month < 10) output = output + "0";
    output = output + ofToString(month) + ".";
    if (day < 10) output = output + "0";
    output = output + ofToString(day) + ", ";
    if (hours < 10) output = output + "0";
    output = output + ofToString(hours) + ".";
    if (minutes < 10) output = output + "0";
    output = output + ofToString(minutes) + ".";
    if (seconds < 10) output = output + "0";
    output = output + ofToString(seconds) + ", ";
    output = output + ofToString(beatTime, 3);
    
    return output;
}
Esempio n. 7
0
void nebulaEye::csvRecordCb(bool & flag){
  if ( flag ){
    csvRecorder.clear();
    ofResetElapsedTimeCounter();

    stringstream ss;
    ss << ofGetYear();
    ss << setfill('0') << setw(2) << ofGetMonth();
    ss << setfill('0') << setw(2) << ofGetDay() << "-";
    ss << setfill('0') << setw(2) << ofGetHours();
    ss << setfill('0') << setw(2) << ofGetMinutes();
    ss << setfill('0') << setw(2) << ofGetSeconds() << ".csv";
    ofLog() << "try to create file : " << ss.str();
    csvRecorder.filePath = ofToDataPath(ss.str());
    ofLog() << "record CSV to : " << csvRecorder.filePath;

    int idx(0);
    csvRecorder.setString(0,idx++,"date");
    csvRecorder.setString(0,idx++,"time");
    csvRecorder.setString(0,idx++,"blob x");
    csvRecorder.setString(0,idx++,"blob y");
    csvRecorder.setString(0,idx++,"flow zone 0");
    csvRecorder.setString(0,idx++,"flow zone 1");
    csvRecorder.setString(0,idx++,"flow zone 2");
    csvRecorder.setString(0,idx++,"flow zone 3");

  } else {
    csvRecorder.saveFile();
    // Save the recorded values in the csvRecorder ofxCsv object
    // csvRecorder.saveFile( ofToDataPath( csvFileName ));
    ofLog() << "Saved " << csvRecorder.numRows << " rows to " << csvRecorder.filePath;
  }
}
bool ofxCameraSequenceRecorder::createNewTimeStampDirectory(){

	ofSetDataPathRoot("./data/"); // relative to data

    folder_name =
    "capture-"+ofToString(ofGetYear())
    +ofToString(ofGetMonth())
    +ofToString(ofGetDay())+"-"
    +ofToString(ofGetHours())
    +ofToString(ofGetMinutes())
    +ofToString(ofGetSeconds());

   string dir = ofToDataPath(folder_name);
   cout << "\n\nCreating new directory for capture: " << dir << endl;

   File file_handle(dir);
   bool success = false;
   try{
      success = file_handle.createDirectory();
   }catch( Poco::Exception &except ){
      ofLog(OF_LOG_ERROR, "Could not make directory");
      return false;
   }

   if(success==false)ofLog(OF_LOG_WARNING, "Could not make directory because it already exists");
   return success;

}
//-----------------------------
void ofxControlPanel::saveSettings(){
    for(int i = 0; i < (int) guiObjects.size(); i++)
    {
        guiObjects[i]->saveSettings();
    }

    for(int i = 0; i < (int) xmlObjects.size(); i++)
    {
        if( xmlObjects[i].guiObj != NULL )
        {
            int numParams = xmlObjects[i].numParams;

            for(int j = 0; j < numParams; j++){
                string str = xmlObjects[i].xmlName+":val_"+ofToString(j);
                settings.setValue(str, xmlObjects[i].guiObj->value.getValueF(j));
            }
        }
    }
    if( incrementSave ){
        string xmlName = incrementSaveName;
        xmlName += ofToString(ofGetYear()) +"-"+ ofToString(ofGetMonth()) +"-"+ ofToString(ofGetDay()) +"-"+ ofToString(ofGetHours()) +"-"+ ofToString(ofGetMinutes())+"-"+ ofToString(ofGetSeconds());
        xmlName += ".xml";
        xmlName = settingsDirectory + xmlName;

        settings.saveFile(xmlName);
    }
    if(currentXmlFile == "") {
        currentXmlFile = "controlPanelSettings.xml";
    }
    settings.saveFile(currentXmlFile);
    usingXml = true;
}
Esempio n. 10
0
void ParticleTrace :: saveFBO ( ofxFBOTexture& fbo )
{
    int y = ofGetYear();
    int m = ofGetMonth();
    int d = ofGetDay();
    int r = ofGetHours();
    int n = ofGetMinutes();
    int s = ofGetSeconds();
    
    char str[255];
    sprintf( str, "screengrab_lrg/image_%02d%02d%02d_%02d%02d%02d.png", y % 1000, m, d, r, n, s );
    
    int w = fbo.getWidth();
    int h = fbo.getHeight();
    
	ofxCvColorImage imgTemp;
	imgTemp.allocate( w, h );
	imgTemp.setFromPixels( (unsigned char*)fbo.getPixels(), w, h );
	imgTemp.mirror( true, false );

	ofImage imgSave;
    imgSave.allocate( w, h, OF_IMAGE_COLOR );
    imgSave.setFromPixels( imgTemp.getPixels(), w, h, OF_IMAGE_COLOR );
    imgSave.saveImage( str );
    
	imgTemp.clear();
    imgSave.clear();
}
Esempio n. 11
0
void testApp :: keyReleased( int key )
{
	if( key == 's' )
	{
		char str[255];
		sprintf( str, "ribbons_%02d%02d%02d_%02d%02d%02d.png", ofGetYear() % 1000, ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds() );
		
		tileSaver.finish( str, false );
	}
	
	if( key == 'a' )
	{
		useAdditiveBlending = !useAdditiveBlending;
		
		if( useAdditiveBlending )
		{
			glDisable( GL_DEPTH_TEST );
			glBlendFunc( GL_SRC_ALPHA, GL_ONE );
		}
		else
		{
			glEnable( GL_DEPTH_TEST );
			glBlendFunc( GL_ONE, GL_ZERO );
		}
	}
}
Esempio n. 12
0
//--------------------------------------------------------------
void testApp::keyPressed(int key)
{
    if(gui2->hasKeyboardFocus())
    {
        return;  
    }
	switch (key) 
	{			
		case '`':
		{
			string hr;         
			ofImage img; 
			img.grabScreen(0,0,ofGetWidth(), ofGetHeight()); 
			if(ofGetHours() < 12)
			{
				hr = " AM"; 
			}
			else
			{
				hr = " PM"; 
			}
			img.saveImage("snapshots/OFXUI "+ofToString(ofGetYear())+"-"+ofToString(ofGetMonth())+"-"+ofToString(ofGetDay())+" at "+ofToString(ofGetHours(),2)+"."+ofToString(ofGetMinutes(),2)+"."+ofToString(ofGetSeconds(),2) +hr +".png");
		}						
			break; 
			
		case 'f':
			ofToggleFullscreen(); 
			break;

		case 'h':
            gui1->toggleVisible(); 
            gui2->toggleVisible(); 
            gui3->toggleVisible();             
			break;

		case 'p':
			bdrawPadding = !bdrawPadding; 
			gui1->setDrawWidgetPaddingOutline(bdrawPadding); 			
			gui2->setDrawWidgetPaddingOutline(bdrawPadding); 			
			gui3->setDrawWidgetPaddingOutline(bdrawPadding); 			            
			break;			

		case '[':
			gui1->setDrawWidgetPadding(false); 			
			gui2->setDrawWidgetPadding(false);
			gui3->setDrawWidgetPadding(false);
			break;			

		case ']':
			gui1->setDrawWidgetPadding(true); 			
			gui2->setDrawWidgetPadding(true);
			gui3->setDrawWidgetPadding(true);
			break;			
			
            
		default:
			break;
	}
}
Esempio n. 13
0
//--------------------------------------------------------------
string ofApp::getTakeName() {
	return ofToString(ofGetYear(), 4, '0') + "-"
		+ ofToString(ofGetMonth(), 2, '0') + "-"
		+ ofToString(ofGetDay(), 2, '0') + "-"
		+ ofToString(ofGetHours(), 2, '0') + "-"
		+ ofToString(ofGetMinutes(), 2, '0') + "-"
		+ ofToString(ofGetSeconds(), 2, '0');
}
Esempio n. 14
0
void testApp::exportFileForStruct(vector<pointPair> ppv){
    int count = ppv.size();
    ofstream out(ofToDataPath("deleteme/foo_"+ofToString(ofGetYear())+"-"+ofToString(ofGetMonth())+"-"+ofToString(ofGetDay())+"_"+ofToString(ofGetHours())+"-"+ofToString(ofGetMinutes())+"-"+ofToString(ofGetSeconds())+".dat").c_str(),ios::out | ios::binary);
    if (!out) return 1;
    out.write(reinterpret_cast<const char*>(&count), sizeof(count));
    out.write(reinterpret_cast<const char*>(&ppv[0]), ppv.size() * sizeof(pointPair));
    out.close();
}
Esempio n. 15
0
//--------------------------------------------------------------
bool testApp::License(int year, int month, int day, int hour, int minute){
    if(ofGetYear()  <= year     &&
       ofGetMonth() <= month    &&
       ofGetDay()   <= day)
        return true;
    else
        return false;
}
Esempio n. 16
0
void ofApp::touchDoubleTap(int x, int y, int id){
    //string fileName = "screenshot/" + ofGetTimestampString() + ".png";
    string fileName= "/sdcard/DCIM/myFolder/ob"
    				+ ofToString(ofGetYear()) + ofToString(ofGetMonth())
    				+ ofToString(ofGetDay()) + ofToString(ofGetHours())
    				+ ofToString(ofGetMinutes()) + ofToString(ofGetSeconds())
    				+ ".png";
    ofSaveScreen(fileName);
}
Esempio n. 17
0
void inputManager::startRecord(){
	
	folderName = "recordedImages/" + ofToString(ofGetMonth(),0) + ofToString(ofGetDay(), 0)
				+ ofToString(ofGetHours(), 0) + ofToString(ofGetMinutes(), 0)
				+ ofToString(ofGetSeconds(), 0);

	fileHelper.makeDirectory(folderName);
	bRecord = true;
}
//--------------------------------------------------------------
void testApp::keyPressed(int key){

	// Time stamp
	file = ofToString(ofGetYear()) + ofToString(ofGetMonth()) +  ofToString(ofGetDay()) +  " " + ofToString(ofGetHours()) +  ofToString(ofGetMinutes()) + ofToString(ofGetSeconds()) + ".png";
	
	if(key == 's') {
		ofSaveScreen(file);
	}

}
Esempio n. 19
0
//--------------------------------------------------------------
void testApp::setup(){
	ofSetFrameRate(120);
	
	// testing getFileName before loading or setFileName
	cout << "bikers:" << bikers.getFileName() << ":" << endl;
	
	/** IMAGE LOADING TEST **/
	
	// testing setFileName and loadImage with empty parameter
	bikers.setFileName("images/bikers.jpg");
	bikers.loadImage();
	
	// testing normal image loading
	gears.loadImage("images/gears.gif");
	tdf.loadImage("images/tdf_1972_poster.jpg");
	tdfSmall.loadImage("images/tdf_1972_poster.jpg");
	tdfSmall.resize(tdf.width / 4, tdf.height / 4);
	tdfSmall.setImageType(OF_IMAGE_GRAYSCALE);
	transparency.loadImage("images/transparency.png");
	transparencyMirror.clone(transparency);
	transparencyMirror.mirror(false, true);
	bikeIcon.loadImage("images/bike_icon.png");
	bikeIcon.setImageType(OF_IMAGE_GRAYSCALE);
	
	// testing getFileName() after loading
	cout << "loaded:" << bikers.getFileName() << endl;
	cout << "loaded:" << gears.getFileName() << endl;
	cout << "loaded:" << tdf.getFileName() << endl;
	cout << "loaded:" << tdfSmall.getFileName() << endl;
	cout << "loaded:" << transparency.getFileName() << endl;
	cout << "loaded:" << bikeIcon.getFileName() << endl;
	cout << endl;
	
	/** IMAGE SAVING TEST **/
	
	// testing normal saveImage
	stringstream nameBuilder;
	char timeDateStr[255];
	sprintf(timeDateStr, "%d-%.2d-%.2d_%.2d%.2d%.2d", ofGetYear(), ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
	
	nameBuilder << "images/" << timeDateStr << "_bikers.jpg";
	bikers.saveImage(nameBuilder.str());
	nameBuilder.str("");
	
	// testing setFileName and saveImage with empty parameter
	nameBuilder << "images/" << timeDateStr << "_gears.png";
	gears.setFileName(nameBuilder.str());
	gears.saveImage();
	nameBuilder.str("");
	
	// testing getFileName() after saving
	cout << "saved:" << bikers.getFileName() << endl;
	cout << "saved:" << gears.getFileName() << endl;
}
void testApp::createFileName(void)
{
	ostringstream oss;
	oss << ofGetYear() << "-";
	oss << setw(2) << setfill('0') << ofGetMonth() << "-";
	oss << setw(2) << setfill('0') << ofGetDay() << "-";
	oss << setw(2) << setfill('0') << ofGetHours() << "-";
	oss << setw(2) << setfill('0') << ofGetMinutes() << "-";
	oss << setw(2) << setfill('0') << ofGetSeconds() << ".mov";
	mFileName = oss.str();	
}
Esempio n. 21
0
void CanonCamera::photoDownloadedHandler(int &code) {
	
    string imgName = wrapper.getLastImageName();
    
    int mth = ofGetMonth();
    
    string newName = "";
    newName += ofToString(ofGetYear()) + "-" + toStr(ofGetMonth()) + "-" + toStr(ofGetDay());
    newName += "_" + toStr(ofGetHours()) + "-" + toStr(ofGetMinutes()) +"-" + toStr(ofGetSeconds());
    newName += ".jpg";
    ofFile("photos/"+imgName).renameTo("photos/"+newName);
    
    lastPhoto.loadImage( "photos/"+newName );
    lastPhoto.rotate90(3);
    lastPhoto.resize(1536, 1536*lastPhoto.height/lastPhoto.width);
    lastPhoto.saveImage("export/"+newName, OF_IMAGE_QUALITY_HIGH );
    
	cout << "photo downloaded" << endl;
	
    ofNotifyEvent(photoDownloadedEvent, code, this);
}
Esempio n. 22
0
void testApp::toLog(const std::string& to_log){

	static bool initLog = false;

	if(!initLog){
		sprintf(logFilename, "log_%02d_%02d_%02d_%02d_%02d.txt", ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
		log.append("Clouds Visual Systems Test Log \n ================================================ \n ");
		initLog = true;
	}

	log.append(to_log);
	logEnd();
}
//--------------------------------------------------------------
string motionDetector::generateFileName() {

    string _root = "kinectRecord";
    string _timestamp = ofToString(ofGetDay()) +
                        ofToString(ofGetMonth()) +
                        ofToString(ofGetYear()) +
                        ofToString(ofGetHours()) +
                        ofToString(ofGetMinutes()) +
                        ofToString(ofGetSeconds());

    string _filename = (_root + _timestamp + ".oni");

    return _filename;
}
Esempio n. 24
0
void testApp::exportFile(){
    vector<unsigned int> testvector;
    testvector.push_back(4);
    testvector.push_back(2);
    testvector.push_back(7);
    testvector.push_back(30);
    testvector.push_back(31);
    
    int count = testvector.size();
    ofstream out(ofToDataPath("deleteme/foo_"+ofToString(ofGetYear())+"-"+ofToString(ofGetMonth())+"-"+ofToString(ofGetDay())+"_"+ofToString(ofGetHours())+"-"+ofToString(ofGetMinutes())+"-"+ofToString(ofGetSeconds())+".dat").c_str(),ios::out | ios::binary);
    if (!out) return 1;
    out.write(reinterpret_cast<const char*>(&count), sizeof(count));// out.write((char *) &count, sizeof(count)); // 最初にサイズを保存
    out.write(reinterpret_cast<const char*>(&testvector[0]), testvector.size() * sizeof(int));
    out.close();
}
Esempio n. 25
0
//--------------------------------------------------------------
void testApp::draw(){
	ofBackground(0);
	//	grabber.draw(0, 0);
	cam.begin();
	//	ofDrawAxis(100);
//	ofDrawGrid(100,10,false,true,true,true);
	ofPushMatrix();
	ofEnableAlphaBlending();
	ofSetColor(255, 255, 255);
	

	vbo.bind();
	vbo.updateVertexData(pos, total);
	vbo.updateColorData(color, total);
	vbo.updateTexCoordData(tex_coord, total);
	if(bUseGrabber)grabber.getTextureReference().bind();
	for (int i=0; i<GRID_WIDTH; i++) {
		for (int j=0; j<GRID_HEIGHT; j++) {
			int index = (j*GRID_WIDTH+i) * LENGTH;
//			for(int k = 0; k < LENGTH ; k++)
			{
//				vbo.draw(GL_LINES, index,LENGTH);
				vbo.draw(GL_TRIANGLE_FAN, index,LENGTH);
			}
		}
	}
	if(bUseGrabber)grabber.getTextureReference().unbind();
	vbo.unbind();
	
	ofPopMatrix();
	cam.end();
	if (bSnap) {
		string hr;
		ofImage img;
		img.grabScreen(0,0,ofGetWidth(), ofGetHeight());
		if(ofGetHours() < 12)
		{
			hr = " AM";
		}
		else
		{
			hr = " PM";
		}
		img.saveImage(ofToString(ofGetYear())+"-"+ofToString(ofGetMonth())+"-"+ofToString(ofGetDay())+" at "+ofToString(ofGetHours(),2)+"."+ofToString(ofGetMinutes(),2)+"."+ofToString(ofGetSeconds(),2) +hr +".png");
		bSnap = false;
	}
	ofDrawBitmapString(ofToString(ofGetFrameRate()), 20,20);
}
Esempio n. 26
0
void ofxDepthImageRecorder::incrementTake(){
	char takeString[1024] ;
	sprintf(takeString, "TAKE_%02d_%02d_%02d_%02d_%02d", ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds());
    currentFolderPrefix = string(takeString);
    ofDirectory dir(targetDirectory + "/" + currentFolderPrefix);
    
    dir.create(true);
	ofDirectory depthDir = ofDirectory(dir.getOriginalDirectory() + "/depth/");
    depthDir.create(true);
	
    //create a color folder for good measure
	ofDirectory colorDir = ofDirectory(dir.getOriginalDirectory() + "/color/");
    colorDir.create(true);
    
    currentFrame = 0;	
    recordingStartTime = msaTimer.getAppTimeMillis();
}
Esempio n. 27
0
void ofApp::setup(){
    etherdream.setup();

    verdana.loadFont("verdana.ttf", 18, false, false, true);

    for (int i = 0; i < 7; i++) {
        drawStringToIldaFrame(std::string(1, "SMTWTFS"[i]), 0.05 + i * 0.13, 0.25, i == 0 ? ofColor::red : ofColor::green);
    }
    
    char buf[3];
    ofxDate date = ofxDate(ofGetYear(), ofGetMonth(), 1);
    int w = date.getWeekday();
    for (int i = 0; i < date.daysPerMonth(); i++) {
        sprintf(buf, "%d", i + 1);
        drawStringToIldaFrame(buf, 0.05 + ((i + w) % 7) * 0.13, 0.35 + 0.1 * ((i + w) / 7), (i + w) % 7 == 0 ? ofColor::red : ofColor::green);
    }
}
Esempio n. 28
0
// make sure to call setPoints before calling this function //
bool Secretary::saveAttributes() {
	cout << "saving attributes" << endl;
	string file_name = _dir_name+"/attributes.txt";
	
	string date_string = ofToString(ofGetMonth()) + "/" + ofToString(ofGetDay()) + "/"+ofToString(ofGetYear());
	
	int total_pts = particles.size();
	
	ofstream myfile (file_name.c_str());
	if (myfile.is_open()) {
		myfile << "Date Rendered : "+date_string+".\n";
		myfile << "Total Points : "+ofToString(total_pts)+".\n";
		
		myfile.close();
	} else { cout << "Unable to open file"; return false;}
	
	return true;
}
Esempio n. 29
0
void testApp :: keyReleased( int key )
{
	if( key == 's' )
	{
		char str[255];
		sprintf( str, "tf_%02d%02d%02d_%02d%02d%02d.png", ofGetYear() % 1000, ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds() );
		
		tileSaver.finish( str, false );
	}
	
	if( key == 'm' )
	{
		if( screenGrabUtil.isRecording() )
		{
			screenGrabUtil.stop();
			
			audio->setFrameRateSync( false );
		}
		else
		{
			screenGrabUtil.start();
			
			audio->setFrameRateSync( true );
		}
	}
	
	if( key == 'd' )
	{
		showDebug = !showDebug;
		
		for( int i=0; i<fieldsTotal * 2; i++ )
		{
			colorPickers[ i ].setVisible( showDebug );
		}
		
		gui.toggleDraw();
	}
	
	if( key == 'f' )
		toggleFullScreen();
	
	if( key == 't' )
		trigger.writeToFile( "trigger_data.txt" );
}
Esempio n. 30
0
//--------------------------------------------------------------
void testApp::keyPressed(int key)
{
	if( key >= '0' && key <= '9' )
	{
		gui.setPage( key - '0' );
		gui.show();
	}
	else
	{
		switch(key)
		{
			case '[': gui.prevPage(); break;
			case ']': gui.nextPage(); break;
		}
	}
	
	if( key == 's' )
	{
		char str[255];
		sprintf( str, "image_%02d%02d%02d_%02d%02d%02d.png", ofGetYear() % 1000, ofGetMonth(), ofGetDay(), ofGetHours(), ofGetMinutes(), ofGetSeconds() );
		
		tileSaver.finish( str, false );
	}
	
	if( key == 'm' )
	{
		screenGrabUtil.togglePause();
	}
	
	if( key == 'd' )
	{
		bDebug = !bDebug;
	}
	
	if( key == 'p' )
	{
		bPause = !bPause;
	}
	
	if( key == ' ' )
	{
		bRotateColor = !bRotateColor;
	}
}