summaryrefslogtreecommitdiff
path: root/gui/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/ofApp.cpp')
-rw-r--r--gui/src/ofApp.cpp67
1 files changed, 59 insertions, 8 deletions
diff --git a/gui/src/ofApp.cpp b/gui/src/ofApp.cpp
index fb179e9..05314d1 100644
--- a/gui/src/ofApp.cpp
+++ b/gui/src/ofApp.cpp
@@ -7,12 +7,6 @@ const float guiScale=560.0f/4096.0f;
//--------------------------------------------------------------
void ofApp::setup(){
- warpframe[0]=glm::vec2(0,0);
- warpframe[1]=glm::vec2(outputWindowSize.x,0);
- warpframe[2]=glm::vec2(outputWindowSize.x,outputWindowSize.y);
- warpframe[3]=glm::vec2(0,outputWindowSize.y);
- select_warpframe=-1;
- bDrawFrame=false;
gui.setup();
@@ -55,12 +49,64 @@ void ofApp::setup(){
bShowPositionInterface=false;
bOutputSelected=false;
- outputPosition=ofPoint(0,0);
- outputScale=1.0f;
outputOffsetScale=1.0f;
commandPressed=false;
+ select_warpframe=-1;
+ bDrawFrame=false;
+
+ if( XML.loadFile("settings.xml") ){
+ cout << "settings.xml loaded!" <<std::endl;
+
+ }
+ else{
+ cout << "unable to load settings.xml"<<std::endl;
+ }
+
+ warpframe[0]=glm::vec2(
+ XML.getValue("WARP:p0:X", 0),
+ XML.getValue("WARP:p0:Y", 0)
+ );
+ warpframe[1]=glm::vec2(
+ XML.getValue("WARP:p1:X", outputWindowSize.x),
+ XML.getValue("WARP:p1:Y", 0)
+ );
+ warpframe[2]=glm::vec2(
+ XML.getValue("WARP:p2:X", outputWindowSize.x),
+ XML.getValue("WARP:p2:Y", outputWindowSize.y)
+ );
+ warpframe[3]=glm::vec2(
+ XML.getValue("WARP:p3:X", 0),
+ XML.getValue("WARP:p3:Y", outputWindowSize.y)
+ );
+
+ outputPosition=ofPoint(
+ XML.getValue("POSITION:X", 0),
+ XML.getValue("POSITION:Y", 0)
+ );
+
+ outputScale=XML.getValue("SCALE", 1.0f);
+
+}
+
+void ofApp::save_settings(){
+ XML.setValue("WARP:p0:X", warpframe[0].x);
+ XML.setValue("WARP:p0:Y", warpframe[0].y);
+ XML.setValue("WARP:p1:X", warpframe[1].x);
+ XML.setValue("WARP:p1:Y", warpframe[1].y);
+ XML.setValue("WARP:p2:X", warpframe[2].x);
+ XML.setValue("WARP:p2:Y", warpframe[2].y);
+ XML.setValue("WARP:p3:X", warpframe[3].x);
+ XML.setValue("WARP:p3:Y", warpframe[3].y);
+
+ XML.setValue("POSITION:X", outputPosition.x);
+ XML.setValue("POSITION:Y", outputPosition.y);
+
+ XML.setValue("SCALE", outputScale);
+
+ XML.saveFile("settings.xml");
+ cout << "settings.xml saved!" <<std::endl;
}
//--------------------------------------------------------------
@@ -504,6 +550,11 @@ void ofApp::keyPressed(ofKeyEventArgs &args){
}
case OF_KEY_COMMAND:{
commandPressed=true;
+ break;
+ }
+ case 's':{
+ save_settings();
+ break;
}
}
}