diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-02-02 16:35:12 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-02-02 16:35:12 +0000 |
| commit | 46f714e3ccb1949706c734944b4ecc3adde0dec3 (patch) | |
| tree | 3ca96ff897d7fc15190398e4459b25c7ee4309dc | |
| parent | 1641253a1f8f6c5e7e7efa676c27e24c82893dfb (diff) | |
settings with defaults
| -rw-r--r-- | bin/data/settings.xml | 6 | ||||
| -rw-r--r-- | map4.cbp | 3 | ||||
| -rw-r--r-- | map4.layout | 9 | ||||
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/testApp.cpp | 23 | ||||
| -rw-r--r-- | src/testApp.h | 4 |
6 files changed, 29 insertions, 18 deletions
diff --git a/bin/data/settings.xml b/bin/data/settings.xml index 3ef31a3..47e851e 100644 --- a/bin/data/settings.xml +++ b/bin/data/settings.xml @@ -1,9 +1,11 @@ <?xml version="1.0" encoding="UTF-8" ?> <map4> <view> - <settings x="0.000000" y="0.000000" w="0.500000" h="1.000000" distort="0.000000" fov="17.250000" roll="90.000000" targX="0.000000" targY="112.000000" targZ="0.000000" lat="0.000000" lng="0.000000" dolly="550.0" /> + <settings x="0.000000" y="0.000000" w="0.500000" h="1.000000" distort="0.000000" fov="17.250000" roll="90.0" targX="0.000000" targY="112.000000" targZ="0.000000" lat="0.000000" lng="0.000000" dolly="1000.000000" /> </view> <view> - <settings x="0.500000" y="0.000000" w="0.500000" h="1.000000" distort="0.000000" fov="17.250000" roll="90.000000" targX="0.000000" targY="112.000000" targZ="0.000000" lat="0.000000" lng="0.000000" dolly="550.0" /> + <settings x="0.500000" y="0.000000" w="0.500000" h="1.000000" distort="0.000000" fov="17.250000" roll="90.0" targX="0.000000" targY="112.000000" targZ="0.000000" lat="0.000000" lng="0.000000" dolly="1000.000000" /> </view> + <clip file="stripey2.mov"/> + <clip file="gradblend01.mov"/> </map4> @@ -111,6 +111,9 @@ <Unit filename="../../../addons/ofxXmlSettings/src/ofxXmlSettings.h"> <Option virtualFolder="addons/ofxXmlSettings/src" /> </Unit> + <Unit filename="bin/data/settings.xml"> + <Option virtualFolder="build config/" /> + </Unit> <Unit filename="config.make"> <Option virtualFolder="build config" /> </Unit> diff --git a/map4.layout b/map4.layout index 75b17ee..2967843 100644 --- a/map4.layout +++ b/map4.layout @@ -4,6 +4,9 @@ <File name="../../../addons/ofx3DModelLoader/src/3DS/model3DS.h" open="0" top="0" tabpos="0"> <Cursor position="136" topLine="0" /> </File> + <File name="bin/data/settings.xml" open="1" top="1" tabpos="6"> + <Cursor position="517" topLine="0" /> + </File> <File name="config.make" open="0" top="0" tabpos="3"> <Cursor position="548" topLine="0" /> </File> @@ -11,7 +14,7 @@ <Cursor position="0" topLine="0" /> </File> <File name="src/main.cpp" open="1" top="0" tabpos="3"> - <Cursor position="865" topLine="0" /> + <Cursor position="421" topLine="0" /> </File> <File name="src/mapUtils.cpp" open="0" top="0" tabpos="7"> <Cursor position="0" topLine="8" /> @@ -19,8 +22,8 @@ <File name="src/mapUtils.h" open="0" top="0" tabpos="6"> <Cursor position="165" topLine="0" /> </File> - <File name="src/testApp.cpp" open="1" top="1" tabpos="2"> - <Cursor position="2650" topLine="92" /> + <File name="src/testApp.cpp" open="1" top="0" tabpos="2"> + <Cursor position="737" topLine="24" /> </File> <File name="src/testApp.h" open="1" top="0" tabpos="1"> <Cursor position="1432" topLine="29" /> diff --git a/src/main.cpp b/src/main.cpp index a0adc83..15650ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ int main( ){ ofAppGlutWindow window; - //ofSetupOpenGL(&window, 2048,768, OF_FULLSCREEN); // <-------- setup the GL context + //ofSetupOpenGL(&window, 1024,768, OF_FULLSCREEN); // <-------- setup the GL context ofSetupOpenGL(&window, 1024,300, OF_WINDOW); glutIgnoreKeyRepeat(1); glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); //these don't work!!! diff --git a/src/testApp.cpp b/src/testApp.cpp index 37717fa..f8078fb 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -1,7 +1,7 @@ #include "testApp.h" //-------------------------------------------------------------- testApp::~testApp(){ - saveSettings(); + saveSettings("settings.xml"); } //-------------------------------------------------------------- void testApp::setup(){ @@ -23,12 +23,12 @@ void testApp::setup(){ //ofDisableArbTex(); - texture.loadMovie("gradblend01.mov"); + texture.loadMovie("stripey2.mov"); texture.play(); mode=CALIBRATE; - loadSettings(); + loadSettings("settings.xml"); light=true; } @@ -99,8 +99,10 @@ void testApp::keyPressed(int key){ activeView=1; break; case 'p': - saveSettings(); - printf("saved settings.xml\n"); + saveSettings("settings.xml"); + break; + case 'z': + loadSettings("defaults.xml"); break; case '/': light=!light; @@ -110,10 +112,10 @@ void testApp::keyPressed(int key){ } } -void testApp::loadSettings(){ +void testApp::loadSettings(string filename){ //viewport settings are float/ normalised to 0..1 - if( !XML.loadFile("settings.xml") ){ - printf("unable to load settings.xml check data/ folder\n"); + if( !XML.loadFile(filename) ){ + printf("unable to load %s check data/ folder\n",filename.c_str()); }else{ if(XML.pushTag("map4")) { numViews=XML.getNumTags("view"); @@ -142,7 +144,7 @@ void testApp::loadSettings(){ //activeView=0; } //-------------------------------------------------------------- -void testApp::saveSettings(){ +void testApp::saveSettings(string filename){ //either re-navigate the whole thing OR //save the number to the vp OR //send a pointer to the vp @@ -160,7 +162,8 @@ void testApp::saveSettings(){ } XML.popTag(); } - XML.saveFile("settings.xml"); + XML.saveFile(filename); + printf("saved %s\n",filename.c_str()); } //-------------------------------------------------------------- void testApp::keyReleased(int key){ diff --git a/src/testApp.h b/src/testApp.h index 07c043f..d0710e2 100644 --- a/src/testApp.h +++ b/src/testApp.h @@ -39,8 +39,8 @@ class testApp : public ofBaseApp{ void update(); void draw(); - void loadSettings(); - void saveSettings(); + void loadSettings(string filename); + void saveSettings(string filename); void keyPressed (int key); void keyReleased(int key); void mouseMoved(int x, int y ); |
