void setupFromXml(string filename) { size = ofVec2f(ofGetWidth(), ofGetHeight()); if (xml.load(filename)) { xml.setTo("STAR[0]"); do { xml.setTo("POSITION"); int x = xml.getValue<float>("X"); int y = xml.getValue<float>("Y"); xml.setToParent(); int m = xml.getValue<int>("MAGNITUDE"); int id = xml.getValue<int>("ID"); BPStar s; s.setPosition(x, y); s.setMagnitude(m); s.setId(id); stars.push_back(s); }while( xml.setToSibling() ); // go to next STAR } else { } shader.load("","SkyShader.frag"); skyShader.setup(); }
void setup() { ofBackground(255); ofSetFrameRate(60); config.load("config.xml"); defaultLength = config.getFloatValue("cable/length/default"); minLength = config.getFloatValue("cable/length/min"); maxLength = config.getFloatValue("cable/length/max"); host = config.getValue("osc/host"); sendPort = config.getIntValue("osc/sendPort"); receivePort = config.getIntValue("osc/receive"); oscSend.setup(host, sendPort); oscReceive.setup(receivePort); local.setup("Local"); remote.setup("Remote"); zeros.setup("Zeros"); zeros.add(nwZero.setup("NW Zero")); zeros.add(neZero.setup("NE Zero")); zeros.add(seZero.setup("SE Zero")); zeros.add(swZero.setup("SW Zero")); nwZero.addListener(this, &ofApp::zeroNW); neZero.addListener(this, &ofApp::zeroNE); seZero.addListener(this, &ofApp::zeroSE); swZero.addListener(this, &ofApp::zeroSW); local.gui.loadFromFile("settings.xml"); local.gui.setPosition(10, 10); zeros.setPosition(10, 200); remote.gui.setPosition(10, 310); }