Esempio n. 1
0
int main()
{
    world.moveAllBoidsToNewPosition();

    for(int i = 0; i<numberOfBoids; i++) {
        boidsShapes[i] = *new sf::CircleShape(10.f, 3);
        boidsShapes[i].setFillColor(sf::Color::Blue);
        boidsShapes[i].setPosition(world.Boids[i].position.x, world.Boids[i].position.y);
        if(i==numberOfBoids-1)
            boidsShapes[i].setFillColor(sf::Color::Red);
    }

    sf::Clock clock;
    window.setVerticalSyncEnabled(true);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
            if (event.type == sf::Event::MouseMoved) {
                world.target = sf::Mouse::getPosition(window);
            }
        }

        drawBoids();

        sf::Int32 t = clock.restart().asMilliseconds();
        std::this_thread::sleep_for(std::chrono::milliseconds(1000-t)/48);
    }

    return 0;
}
Esempio n. 2
0
//--------------------------------------------------------------
void testApp::draw(){
	
	ofClear(255, 255, 255, 0);
	ofSetColor(255, 255, 255,255);
	
	//Draw Flying Videos
	drawBoids();
	
	//Clear Background
	ofClear(255, 255, 255, 0); //Tranparent Background)
	ofBackground(255, 255, 255, 0); //Tranparent Background
	
	//Text 
	ofFill();
	
    if (cvImgDisp) {
         ofSetColor(255, 0, 0); // RED FOR DEBUG
    }else{
        ofSetColor(255, 255, 255,255); // White for display color
    }
   
	drawText();
	
	
	
	ofSetColor(210, 229, 247, 255);  //BACKGROUND FOR FLYERS
	ofRect(0,0, ofGetWidth(), ofGetHeight());     
	ofSetColor(255, 255, 255,255);
	////COVER TEXT
	
	
	//Cutout
	
    ofSetColor(255, 255, 255,255); //ofSetColor can change the tint of an image, this resets is
	cutoutTex.draw(0-videoPos,(ofGetHeight()/2)-(camHeightScale/2) , camWidthScale, camHeightScale);  // correct proportions
	
    
    
        
	//Show the 'End Record Sequence'
	if (endRecordSequence == true) {
		
		string goodbye = "Tu voles maintenant sur la Carte Blanche!";
		ofPushStyle();
		ofSetColor(28, 20, 255);
		ofPushMatrix();
		
		ofTranslate(900, (ofGetHeight()/2)+350);
		
		ofRotateZ(-90);
		
		shimmer.drawString(goodbye, 0, 0);
		ofPopMatrix();
		ofPopStyle();
		
	}
    
	//Tell people that the buffer is full if that is true
    if (bufferFull && !endRecordSequence) {
        
        string full = "La carte est plein! Jouer, mais le system t'enrigistre pas";
		ofPushStyle();
		ofSetColor(28, 20, 255);
		
		ofPushMatrix();
		ofTranslate(900, (ofGetHeight()/2)+480);
		ofRotateZ(-90);
		shimmer.drawString(full, 0, 0);
		ofPopMatrix();
		ofPopStyle();
        
    }
	
	//Progress bar for recording
	ofRect(800,(ofGetHeight()/2), 20, (100-index)*2); 
	ofRect(800,(ofGetHeight()/2), 20, -(100-index)*2);
	
	
	//Debug Functions
	shimmer.drawString(ofToString(showState), ofGetWidth()-50, ofGetHeight()-50);
	
	if (cvImgDisp) {
		cvImages();
	}
    
	//get the last playIndex before the program loops back 
    lastPlayIndex = playIndex; 
	
	 
}
//--------------------------------------------------------------
void testApp::draw(){
	
	
	ofClear(255, 255, 255, 0);
	ofSetColor(255, 255, 255,255);
	
	//Draw Flying Videos
	drawBoids();
	
	//Clear Background
	ofClear(255, 255, 255, 0); //Tranparent Background)
	ofBackground(255, 255, 255, 0); //Tranparent Background
	
	//Text 
	ofFill();
	
    if (cvImgDisp) {
         ofSetColor(255, 0, 0); // RED FOR DEBUG
    }else{
        ofSetColor(255, 255, 255,255); // White for display color
    }
   
	drawText();
	
	
	ofSetColor(210, 229, 247, 255);  //BACKGROUND FOR FLYERS
	ofRect(0,0, ofGetWidth(), ofGetHeight()); 
	
    //bgImg.draw(0,0); // TEXTURE FOR FLYERS
	// OR VIDEO TEXTURE
	
	
	//bgVideo.play();
	
	
	/*
	bgVideo.draw(0,0,ofGetWidth(), ofGetHeight());
	*/
	
	
	// MULTIPLE SEQUENCE
	/*
	if(endRecordSequence == true){
		
		bgVideoEndRec.play();
		bgVideoEndRec.draw(0,0,ofGetWidth(), ofGetHeight());
		bgVideo.stop();
	
	}else {
		
		bgVideo.play();
		bgVideo.draw(0,0,ofGetWidth(), ofGetHeight());
		bgVideoEndRec.stop();
	}
	*/
	
	
		if(posBgImg >= 0 && endRecordSequence){
			posBgImg = 0;
		}else{
			posBgImg = videoPos*1-960;
		} 
	
	
	bgImg.draw(posBgImg,0 , 1920, ofGetHeight()); // TEXTURE FOR FLYERS
	
	ofSetColor(255, 255, 255,255);
	////COVER TEXT
	
	
	//Cutout
	
    ofSetColor(255, 255, 255,255); //ofSetColor can change the tint of an image, this resets is
	cutoutTex.draw((0-videoPos*1.5)+200,(ofGetHeight()/2)-(camHeightScale/2) , camWidthScale, camHeightScale);  // correct proportions
	
    
    
        
	//Show the 'End Record Sequence'
	if (endRecordSequence == true) {
		
		string goodbye = "Tu voles maintenant sur la Carte Blanche!";
		ofPushStyle();
		//ofSetColor(28, 20, 255);
		ofPushMatrix();
		
		ofTranslate(900, (ofGetHeight()/2)+350);
		ofRotateZ(-90);
		
		ofSetColor(255, 255, 255);
		shimmer.drawString(goodbye, 0, 0);
		
		ofSetColor(28, 20, 255);
		shimmer.drawString(goodbye, 1, 1);
		
		ofPopMatrix();
		ofPopStyle();
		
	}
    
	//Tell people that the buffer is full if that is true
    if (bufferFull && !endRecordSequence) {
        
        string full = "La carte est pleine! L'enregistrement reprendra lors du prochain spectacles";
		ofPushStyle();
		ofSetColor(28, 20, 255);
		
		ofPushMatrix();
		ofTranslate(900, (ofGetHeight()/2)+480);
		ofRotateZ(-90);
		shimmer.drawString(full, 0, 0);
		ofPopMatrix();
		ofPopStyle();
        
    }
	
	//Progress bar for recording
	//ofSetColor(255-(100-index)*2,0,0,255);
	
	//ofSetColor(0, 229, 247, 255); 
	
	
	
	if(endRecordSequence == false){
		
		ofSetColor(255, 0, 0, 50); 
		ofRect(800,(ofGetHeight()/2), 15, 200); 
		ofRect(800,(ofGetHeight()/2), 15, -200);
		
		ofSetColor(255, 0, 0, 255); 
		/*
		ofRect(800,(ofGetHeight()/2), 15, (100-index)*2); 
		ofRect(800,(ofGetHeight()/2), 15, -(100-index)*2);
		*/
		
		
		//videoProgessBar = videoProgressBar - videoPos;
		/*
		if(videoProgressBar ==  0){
			endRecordSequence =true;
		}else {
			endRecordSequence=false;
		}
        */
		
		
		ofRect(800,(ofGetHeight()/2), 15, (100-videoPos/4)*2); 
		ofRect(800,(ofGetHeight()/2), 15, -(100-videoPos/4)*2);
		
		// test circle progress
		// ofCircle((ofGetHeight()/2),(150+index)*2,20);
		
		ofSetColor(255, 255, 255, 255); 
		
		//posBgImg = -1280;
		
		/*
		progressBar.draw(800,(ofGetHeight()/2), 20, 200);
		progressBar.draw(800,(ofGetHeight()/2), 20, -200); 
		*/
		
		/*
		progressBar.draw(800,(ofGetHeight()/2), 20, (100-index)*2);
		progressBar.draw(800,(ofGetHeight()/2), 20, -(100-index)*2); 
		*/
		
		ofSetColor(210, 229, 247, 120); 
		ofNoFill();
		ofRect(794,(ofGetHeight()/2)-205,25,410);
		
		
	}else{
		ofRect(800,0, 15, 0); 
		ofRect(800,0, 15, 0);
		progressBar.draw(800,0, 15, 0);
		progressBar.draw(800,0, 15, 0);

	}
	
	
	
	
	/* OLD MECANISM FOR THE PROGRESS BAR
	ofSetColor(255-(100-index)*2,0,0,255);
	ofRect(800,(ofGetHeight()/2), 20, (100-index)*2); 
	ofRect(800,(ofGetHeight()/2), 20, -(100-index)*2);
	*/
	
	//Debug Functions
	// shimmer.drawString(ofToString(index), ofGetWidth()-50, ofGetHeight()-50);
	
	ofSetColor(0,0,0, 120);
	//shimmer.drawString(ofToString(showState), ofGetWidth()-50, ofGetHeight()-50);
	//shimmer.drawString(ofToString(posBgImg), ofGetWidth()-150, ofGetHeight()-100);
	
	//shimmer.drawString(ofToString(lowBlob), ofGetWidth()-300, ofGetHeight()-100);
	//shimmer.drawString(ofToString(highBlob), ofGetWidth()-300, ofGetHeight()-150);
	
	
	/*
	shimmer.drawString(ofToString(showBoidsHead-showBoidsTail), ofGetWidth()-180, 50);
	shimmer.drawString("de" , ofGetWidth()-120, 50);
	shimmer.drawString(ofToString(bufferSize), ofGetWidth()-70, 50);
	shimmer.drawString(ofToString(posBgImg), ofGetWidth()-200, 100);
	*/

	//shimmer.drawString(ofToString(videoPos), ofGetWidth()-70, 50);
	//shimmer.drawString(ofToString(highBlob), ofGetWidth()-200, 100);
	
	if (cvImgDisp) {
		cvImages();
	}
    
	//get the last playIndex before the program loops back 
    lastPlayIndex = playIndex; 
	
	 
}