summaryrefslogtreecommitdiff
path: root/lasertext/src/ofApp.cpp
diff options
context:
space:
mode:
authorTim Redfern <tim@getdrop.com>2022-08-16 00:36:53 +0100
committerTim Redfern <tim@getdrop.com>2022-08-16 00:36:53 +0100
commit3f24a2f8f7f05b9200fb0f5341a3fc1139ee7748 (patch)
treecf2e448ae5539bd1c6eb00ace937be6c5f199f0a /lasertext/src/ofApp.cpp
parent1fd61e1304cba349b4c1233919c862ae22b2ecff (diff)
add gui
Diffstat (limited to 'lasertext/src/ofApp.cpp')
-rw-r--r--lasertext/src/ofApp.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp
index adb393f..2974056 100644
--- a/lasertext/src/ofApp.cpp
+++ b/lasertext/src/ofApp.cpp
@@ -22,10 +22,33 @@ void ofApp::setup(){
laser.set_pts(MAX_POINTS);
laser.set_intensity(LASER_INTENSITY);
+
+ lasergui.setup("laser","",5,700);
+ lasergui.add(laser_power.set("power", true));
+ lasergui.add(laser_intensity.set("intensity", 30, 0, 255));
+ lasergui.add(laser_points.set("points", 30000, 0, 40000));
+ lasergui.add(laser_subdivide.set("subdivide", 15, 1, 100));
+ lasergui.add(laser_blank_num.set("blank points", 8, 0, 32));
+ lasergui.add(laser_max_angle.set("max angle", 15.0f, 1.0f, 90.0f));
+
+ if( XML.loadFile("settings.xml") ){
+ cout << "settings.xml loaded!" <<std::endl;
+
+ }
+ else{
+ cout << "unable to load settings.xml"<<std::endl;
+ }
}
//--------------------------------------------------------------
void ofApp::update(){
- banner.update(10.0f);
+ banner.update(1.0f);
+
+ laser.set_pts(laser_points);
+ laser.set_subdivide(laser_subdivide);
+ laser.set_blanknum(laser_blank_num);
+ laser.set_maxangle(laser_max_angle);
+
+ laser.set_intensity(laser_intensity);
}
//--------------------------------------------------------------
@@ -33,9 +56,13 @@ void ofApp::draw(){
ofBackground(0,0,0);
ofSetColor(255,255,255);
- vector<colourPolyline> shapes = banner.getOutlines(0.06f+(0.02f*sin(ofGetElapsedTimef()*.1f)));
+ lasergui.draw();
+
+ vector<colourPolyline> shapes = banner.getOutlines(0.08f); //+(0.02f*sin(ofGetElapsedTimef()*.1f)));
+
+ int num = 0;
- int num = laser.draw(shapes);
+ if (laser_power) num=laser.draw(shapes);
//banner.draw();
@@ -49,7 +76,7 @@ void ofApp::draw(){
ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num));
}
else {
- ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser error ");
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off ");
}
}