diff options
| author | Tim Redfern <tim@getdrop.com> | 2022-08-25 21:55:37 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@getdrop.com> | 2022-08-25 21:55:37 +0100 |
| commit | 835ce29a83b134b037c5d9d4b9fc7a7d0cb1ada4 (patch) | |
| tree | be7c3d0539ffd8e882793e4bbac766173fb290e1 /lasertext/src/ofApp.cpp | |
| parent | 77ce73a9b57cf3deac08720b449886b71412ea2f (diff) | |
store laser and stars settings
Diffstat (limited to 'lasertext/src/ofApp.cpp')
| -rw-r--r-- | lasertext/src/ofApp.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp index a4e076d..89fa856 100644 --- a/lasertext/src/ofApp.cpp +++ b/lasertext/src/ofApp.cpp @@ -20,12 +20,14 @@ void ofApp::setup(){ banner.loadFont("fonts/EMSDecorousScript.svg"); // EMSPepita.svg"); //fonts.getPath(currentFont)); banner.init("Everything Is Going To Be Alright"); - starsgui.setup("stars","",5,350); + starsgui.setup("stars","",5,450); starsgui.add(stars_x.set("x", 0.0f, -2000.0f, 2000.0f)); starsgui.add(stars_y.set("y", 0.0f, -2000.0f, 2000.0f)); + starsgui.add(stars_rate.set("y", 1.0f, 0.01f, 3.0f)); starsgui.add(stars_radius.set("radius", 100.0f, 10.0f, 500.0f)); starsgui.add(stars_speed.set("speed", 5.0f, 0.0f, 10.0f)); starsgui.add(stars_life.set("life", 4.0f, 3.0f, 10.0f)); + starsgui.add(bScanStars.set("scan", true)); textgui.setup("text","",5,650); @@ -74,6 +76,19 @@ void ofApp::setup(){ laser_pos_y=XML.getValue("POSITION:Y", 0); laser_scale=XML.getValue("SCALE", 1.0f); + laser_intensity=XML.getValue("laser:intensity",30); + laser_points=XML.getValue("laser:points",30000); + laser_subdivide=XML.getValue("laser:subdivide",15); + laser_blank_num=XML.getValue("laser:blankpoints",8); + laser_max_angle=XML.getValue("laser:maxangle",15.0f); + + stars_x=XML.getValue("stars:X",0.0f); + stars_y=XML.getValue("stars:Y",0.0f); + stars_rate=XML.getValue("stars:rate",1.0f); + stars_radius=XML.getValue("stars:radius",100.0f); + stars_speed=XML.getValue("stars:speed",5.0f); + stars_life=XML.getValue("stars:life",4.0f); + stars.init(ofVec2f(2000.0f,2000.0f),100.0f,1.0,5.0,4.0,1.0); } @@ -104,6 +119,19 @@ void ofApp::save_settings(){ XML.setValue("SCALE", laser_scale); + XML.setValue("laser:intensity",laser_intensity); + XML.setValue("laser:points",laser_points); + XML.setValue("laser:subdivide",laser_subdivide); + XML.setValue("laser:blankpoints",laser_blank_num); + XML.setValue("laser:maxangle",laser_max_angle); + + XML.setValue("stars:X",stars_x); + XML.setValue("stars:Y",stars_y); + XML.setValue("stars:rate",stars_rate); + XML.setValue("stars:radius",stars_radius); + XML.setValue("stars:speed",stars_speed); + XML.setValue("stars:life",stars_life); + XML.saveFile("settings.xml"); cout << "settings.xml saved!" <<std::endl; } @@ -121,6 +149,7 @@ void ofApp::update(){ stars.centre=ofVec2f(stars_x,stars_y); + stars.rate=stars_rate; stars.radius=stars_radius; stars.speed=stars_speed; stars.lifespan=stars_life;; @@ -189,14 +218,22 @@ void ofApp::draw(){ ofSetColor(255,255,255); - vector<colourPolyline> starshapes=stars.getPoints(); + vector<scannableColourPolyline> starshapes=stars.getPoints(); + + if (bScanStars){ + std::sort(starshapes.begin(),starshapes.end()); + } + + vector<colourPolyline> laserstars; + int numstars=0; for (auto& s: starshapes) { numstars+=s.size(); s.draw(); + laserstars.push_back((colourPolyline)s); } - num+=laser.draw(starshapes); + num+=laser.draw(laserstars); if (num>0){ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(numstars)); |
