void MagicLightCircle::setup(int resolution)
{
  radius = 200;
  totMagicPoints = resolution;
  reverseLogic = true;
  for(int a = 0; a < resolution; a++)
  {
    addNewMagicPoint();
  }

  int cont = 0;
  int startPosOffset = 20;
  for(int a = 0;  a < totMagicPoints; a++)
  {
    int pos = a;
    int index = pos;
    int outputPort = pos;
    if(outputPort >= resolution)
      outputPort = resolution - resolution;
    if(a == 23)
      outputPort = 27;
    if(outputPort > 11)
      outputPort += 3;
    if(a == 16)
      outputPort = 14;
    magicPoints[a]->setOutputPort(outputPort);
  }
  setupPixelMapping();
  setupDMX();
  setupOSC();
  setupAudio();
  timerNoPoints = 0;
}
예제 #2
0
파일: testApp.cpp 프로젝트: dasaki/cvcinema
///*****************************************************************
///
///                        SETUP
///
///*****************************************************************
void testApp::setup(){
   // ofSetLogLevel(OF_LOG_NOTICE);
    bLiveVideo = true;
    bShowGui = false;
    selOutput = OUTPUT_IMAGE;
    bRecording = false;
    bMovieAudio = false;
    bFullScreen = false;
	saveFrame = false;
	threshold = 50;
    // if we set BG subtraction as default (no. 2) there is a segmentation fault because the background image is not set for the first frame
	algorithm = 1;
	cropping = '6';
	bZoomTarget = false;
	cols = 1;
	rows = 1;
	lastTime = ofGetElapsedTimeMillis();
	currFrameNum = 0;
	videoFPS = 0;
	imgLogos.loadImage("faldon-logos.bmp");
	imgLogos.resize(ofGetWidth(), round(imgLogos.height*((float)ofGetWidth()/(float)imgLogos.width)));
	//ofEnableAlphaBlending();
    ofSetVerticalSync(true);
    ofSetFrameRate(30);
    string devfile = "/dev/video"+ofToString(VIDEO_DEVICE_ID);
    settings.setup(devfile);

    vidGrabber.setVerbose(true);
    vidGrabber.setDeviceID(VIDEO_DEVICE_ID);
    vidGrabber.setDesiredFrameRate(30);
    if (bLiveVideo) setupLiveVideo();
    else loadMovie();
    setupGui();
#ifdef OFX_FENSTER
	outWinListener.setup();
	outWinListener.setImage(&blendImg);
#endif
    //recorder.setupRecordWindow(0,0,1024,576,24,"capture.mp4",ofxGstVideoRecorder::H264,30);
    //recorder.setupRecordWindow((DRAW_SPACE*2+320),(DRAW_SPACE*2+240+out_H_gap),analysisW*2,analysisH,24,"bg_sub_vs_bg&fd_01.mp4",ofxGstVideoRecorder::H264,30);

    setupOSC();
    blendMode = OF_BLENDMODE_ADD;//OF_BLENDMODE_ALPHA;
    alphaValues[0] = alphaValues[1] = alphaValues[2] = alphaValues[3] = 64;
    loadCameras();
}
void ofApp::setup()
{
	// Set framerate to 60 FPS
	ofSetFrameRate(60);

	// ARDUINO SETUP
	setupArduino();
	
	// CLIENT SERVER SETUP
	setupOSC();

	
	// ASTEROIDS GAME SETUP
	// we decided to remove the sounds for this delivery because audio was not suported in the classrooms (54.008 and 54.009)
	loadAsteroids();
	noPlayers = 2;
	SpaceShip* player;	
	player = new SpaceShip(1);
	players.push_back(player);
	players[0]->setImage("ship_green.png");
	player = new SpaceShip(2);
	players.push_back(player);
	players[1]->setImage("ship_blue.png");
	ofBackground(0); // Set background to black
	debug = false;
	//shot.setSpeed(4.0f);
	//shot.setVolume(0.3f);
	
	
	ofxLabel line; // no idea what is this line for

	// GUI SETUP
	// the gui shows the remaining lifes and the score of each player but since we use 
	// the game logic of the other team, the lifes do not decrease when the player dies
	// now, the game finishes when a player reaches 5000 points
	gui.setup();
	gui.add(Player1Lifes.setup("Player1 Lifes", "3"));
	gui.add(Player2Lifes.setup("Player2 Lifes", "3"));
	gui.add(Player1Score.setup("Player1 Score", "0"));
	gui.add(Player2Score.setup("Player2 Score", "0"));
	serialConnection.writeByte('h');
}
예제 #4
0
//--------------------------------------------------------------
void ofApp::setup(){
    //setup initial ip addresses
    iPadIP = "";
    iPhoneIP = "";
    osxIP = "";
    
    //set framerate
    ofSetFrameRate(24);
    
    //set count
    count = 0;
    
    //set debug and sendosc
    debug = false;
    sendOSC = false;
    
    //setup ui and our first video
    setupUI();
    setupVideo();
    
    //setup osc
    setupOSC();
    
    //hide cursor
    CGDisplayHideCursor(NULL);
    
    //set gotjson
    gotJSON = false;
    
    //set ss
    ss << "No video information received yet" << endl;
    
    //load json
    loadJSON();
    
    ofRegisterURLNotification(this);
    videosDownloaded = 0;

}
//--------------------------------------------------------------
void testApp::guiEvent(ofxUIEventArgs &e)
{
    string name = e.widget->getName();
	int kind = e.widget->getKind();
	cout << "got event from: " << name << endl;
	
	if(name == "iPhone IP")
    {
        ofxUITextInput *textinput = (ofxUITextInput *) e.widget;
        if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER)
        {
            iPhoneIP = textinput->getTextString();
            cout << "ON ENTER: ";
            //            ofUnregisterKeyEvents((testApp*)this);
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS)
        {
            cout << "ON FOCUS: ";
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS)
        {
            cout << "ON BLUR: ";
            //            ofRegisterKeyEvents(this);
        }
        string output = textinput->getTextString();
        cout << output << endl;
    }
    
    if(name == "OS X IP")
    {
        ofxUITextInput *textinput = (ofxUITextInput *) e.widget;
        if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER)
        {
            osxIP = textinput->getTextString();
            
            cout << "ON ENTER: ";
            //            ofUnregisterKeyEvents((testApp*)this);
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS)
        {
            cout << "ON FOCUS: ";
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS)
        {
            cout << "ON BLUR: ";
            //            ofRegisterKeyEvents(this);
        }
        string output = textinput->getTextString();
        cout << output << endl;
    }
    
    if(name == "iPad IP")
    {
        ofxUITextInput *textinput = (ofxUITextInput *) e.widget;
        if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_ENTER)
        {
            
            iPadIP = textinput->getTextString();
            
            cout << "ON ENTER: ";
            //            ofUnregisterKeyEvents((testApp*)this);
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_FOCUS)
        {
            cout << "ON FOCUS: ";
        }
        else if(textinput->getTriggerType() == OFX_UI_TEXTINPUT_ON_UNFOCUS)
        {
            cout << "ON BLUR: ";
            //            ofRegisterKeyEvents(this);
        }
        string output = textinput->getTextString();
        cout << output << endl;
    }
    
    else if(name == "Sync Video")
    {
        ofxUIToggle *toggle = (ofxUIToggle *) e.widget;
        setupOSC();
        sendOSC = toggle->getValue();
    }
    
    else if(name == "Download videos")
    {
        ofxUIButton *button = (ofxUIButton *) e.widget;
        //setupOSC();
        //sendOSC = toggle->getValue();
        if(button->getValue() == 1){
            downloadVideos();
        }
        //cout << name << "\t value: " << button->getValue() << endl;
    }
    
    else if(name == "Update JSON")
    {
        ofxUIButton *button = (ofxUIButton *) e.widget;
        //setupOSC();
        //sendOSC = toggle->getValue();
        if(button->getValue() == 1){
            getJSON();
        }
        //cout << name << "\t value: " << button->getValue() << endl;
    }
    
    else if(name == "SELECT A VIDEO")
    {
        ofxUIDropDownList *ddlist = (ofxUIDropDownList *) e.widget;
        vector<ofxUIWidget *> &selected = ddlist->getSelected();
        for(int i = 0; i < selected.size(); i++)
        {
            cout << "SELECTED: " << selected[i]->getName() << endl;
            changeVideo(selected[i]->getName());
        }
    }
}
예제 #6
0
//--------------------------------------------------------------
void gamuzaMain::setup(){

	flagSystemLoaded	= false; // first line of gamuza setup

	//////////////////////////////////////////////
	// load settings from xml
	loadGamuzaSettings();
	// automation
    isFullscreen = false;
	if(autoPilot){
		gamuzaFullscreen();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// init general openframeworks settings
    ofSetEscapeQuitsApp(false);
	ofSetFrameRate(200);
	ofEnableSmoothing();
	ofSetLogLevel(OF_LOG_VERBOSE);
	//////////////////////////////////////////////

    //////////////////////////////////////////////
	// OSC data sending @ host_number(IP),host_port
    gamuzaSetup.lock();
    setupOSC();
    gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// AUDIO
	if(audioActivated){
		gamuzaSetup.lock();
		setupAudio();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

    //////////////////////////////////////////////
	// MIDI
    gamuzaSetup.lock();
    setupMidi();
    gamuzaSetup.unlock();
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// OPENNI
	if(openniActivated){
		gamuzaSetup.lock();
		sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState);
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// FBO second screen output texture
	gamuzaSetup.lock();
	setupFBO();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// ARDUINO
	if(arduinoActivated){
		gamuzaSetup.lock();
		setupArduino();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// GUI
	// include setup of webcams & audio inputs
	gamuzaSetup.lock();
    setupSettingPanel();
	setupGui();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	currentSavedFrame   = 0;
    gaFrameCounter      = 0;
    //////////////////////////////////////////////

	//////////////////////////////////////////////
	// set log level to error only
	ofSetLogLevel(OF_LOG_ERROR);
    sendPrivateMessage(GAMUZA_CONSOLE_LOG, " ");
	//////////////////////////////////////////////

}
예제 #7
0
//--------------------------------------------------------------
void gamuzaMain::setup(){

	flagSystemLoaded	= false; // first line of gamuza setup

	//////////////////////////////////////////////
	// load settings from xml
	loadGamuzaSettings();
	if(START_WITH_FULLSCREEN){
		isFullscreen = true;
	}else{
		isFullscreen = false;
	}
	// automation
	if(autoPilot){
		gamuzaFullscreen();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// init general openframeworks settings
	ofSetFrameRate(FPS);
	ofEnableSmoothing();
	ofSetLogLevel(OF_LOG_VERBOSE);
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// AUDIO
	if(audioActivated){
		gamuzaSetup.lock();
		setupAudio();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// OPENNI
	if(openniActivated){
		gamuzaSetup.lock();
		sensorKinect.setupDevice(workingW,workingH,useKinectInfrared,sensorKinectLedState);
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// FBO second screen output texture
	gamuzaSetup.lock();
	setupFBO();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// OSC data sending @ host_number(IP),host_port
	if(oscActivated){
		gamuzaSetup.lock();
		setupOSC();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// ARDUINO
	if(arduinoActivated){
		gamuzaSetup.lock();
		setupArduino();
		gamuzaSetup.unlock();
	}
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// GUI
	// include setup of webcams & audio inputs
	gamuzaSetup.lock();
	setupGui();
	gamuzaSetup.unlock();
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// SYSTEM
	currentSavedFrame = 0;
	//////////////////////////////////////////////

	//////////////////////////////////////////////
	// set log level to error only
	ofSetLogLevel(OF_LOG_ERROR);
	//////////////////////////////////////////////

}