コード例 #1
0
ファイル: mpeClientTCP.cpp プロジェクト: Hebali/ItpResidency
//--------------------------------------------------------------
// Loads the settings from the Client INI file.
//--------------------------------------------------------------
void mpeClientTCP::loadIniFile(string _fileString) {
	out("Loading settings from file " + _fileString);
    
	ofxXmlSettings xmlReader;
    if (!xmlReader.loadFile(_fileString)) 
        err("ERROR loading XML file!");
	
    // parse INI file
    hostName   = xmlReader.getValue("settings:server:ip", "127.0.0.1", 0);
    serverPort = xmlReader.getValue("settings:server:port", 7887, 0);
	id         = xmlReader.getValue("settings:client_id", -1, 0);
	
	setLocalDimensions(xmlReader.getValue("settings:local_dimensions:width",  640, 0), 
					   xmlReader.getValue("settings:local_dimensions:height", 480, 0));
    
    setOffsets(xmlReader.getValue("settings:local_location:x", 0, 0),
               xmlReader.getValue("settings:local_location:y", 0, 0));
	
	setMasterDimensions(xmlReader.getValue("settings:master_dimensions:width",  640, 0), 
						xmlReader.getValue("settings:master_dimensions:height", 480, 0));
	
	if (xmlReader.getValue("settings:go_fullscreen", "false", 0).compare("true") == 0)
		ofSetFullscreen(true);
    
	if(xmlReader.getValue("settings:offset_window", "false", 0).compare("true") == 0)
		ofSetWindowPosition(xOffset, yOffset);
	
	if (xmlReader.getValue("settings:debug", 0, 0) == 1) 
        DEBUG = true;
	
    out("Settings: server = " + hostName + ":" + ofToString(serverPort) + ",  id = " + ofToString(id)
        + ", local dimensions = " + ofToString(lWidth) + ", " + ofToString(lHeight)
        + ", location = " + ofToString(xOffset) + ", " + ofToString(yOffset));
}
コード例 #2
0
//--------------------------------------------------------------
// Loads the settings from the Client XML file.
//--------------------------------------------------------------
void mpeClientTCP::loadIniFile(string _fileString) {
	out("Loading settings from file " + _fileString);

	ofxXmlSettings xmlReader;
    if (!xmlReader.loadFile(_fileString)){
        err("ERROR loading XML file!");
		return;
	}

    // parse INI file
    hostName   = xmlReader.getValue("settings:server:ip", "127.0.0.1", 0);
    serverPort = xmlReader.getValue("settings:server:port", 7887, 0);
    //turn this off if you don't want this client to sync frames but can still
    //receive messages. default is ON as that's the normal behavior
    frameLock = xmlReader.getValue("settings:framelock", true);
    if(frameLock){
        id         = xmlReader.getValue("settings:client_id", -1, 0);
        clientName = xmlReader.getValue("settings:client_name", "noname", 0);
    }
    else{
        cout << "opting out of frame lock" << endl;
    }
	cout << "***MPE:: HOST IS " << hostName << " Server Port is " << serverPort << endl;

	setLocalDimensions(xmlReader.getValue("settings:local_dimensions:width",  640, 0),
					   xmlReader.getValue("settings:local_dimensions:height", 480, 0));

    setOffsets(xmlReader.getValue("settings:local_location:x", 0, 0),
               xmlReader.getValue("settings:local_location:y", 0, 0));

	setMasterDimensions(xmlReader.getValue("settings:master_dimensions:width",  640, 0),
						xmlReader.getValue("settings:master_dimensions:height", 480, 0));

    goFullScreen = xmlReader.getValue("settings:go_fullscreen", "false", 0).compare("true") == 0;
    offsetWindow = xmlReader.getValue("settings:offset_window", "false", 0).compare("true") == 0;

    setupViewport();

	if (xmlReader.getValue("settings:debug", 0, 0) == 1){
        DEBUG = true;
	}

    if(xmlReader.getValue("settings:simulation:on", 0, 0) == 1){
        useSimulationMode(xmlReader.getValue("settings:simulation:fps", 30));
        cout << "using simulation mode" << endl;
    }

    out("Settings: server = " + hostName + ":" + ofToString(serverPort) + ",  id = " + ofToString(id)
        + ", local dimensions = " + ofToString(lWidth) + ", " + ofToString(lHeight)
        + ", location = " + ofToString(xOffset) + ", " + ofToString(yOffset));
}