summaryrefslogtreecommitdiff
path: root/lasertext/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lasertext/src/ofApp.cpp')
-rw-r--r--lasertext/src/ofApp.cpp85
1 files changed, 55 insertions, 30 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp
index 391aa37..e58e361 100644
--- a/lasertext/src/ofApp.cpp
+++ b/lasertext/src/ofApp.cpp
@@ -22,20 +22,15 @@ void ofApp::setup(){
ofLogNotice()<<"found "<<fonts.size()<<" fonts";
currentFont=0;
- banner.loadFont("fonts/EMSDecorousScript.svg"); // EMSPepita.svg"); //fonts.getPath(currentFont));
+ // EMSPepita.svg"); //fonts.getPath(currentFont));
+ //banner.loadFont("fonts/EMSDecorousScript.svg"); //2022
+ banner.loadFont("fonts/EMSQwandry.svg"); //2023
//banner.init("Everything Is Going To Be Alright");
banner.init("No Pleasure is Too Guilty");
-/*
- stars.allocate(1);
-
- for (int i=0;i<stars.size();i++){
- stars.init("stars "+ofToString(i+1),5,450);
- }
-
- */
- stars.init("stars "+ofToString(1),990,10);
+ stars1.init("stars 1",990,10);
+ stars2.init("stars 2",990,205);
textgui.setup("text","",5,650);
textgui.add(laser_scale.set("scale", 1.0f, 0.5f, 3.0f));
@@ -62,6 +57,8 @@ void ofApp::setup(){
cout << "unable to load settings.xml"<<std::endl;
}
+ //default_settings();
+
warpframe[0]=glm::vec2(
XML.getValue("WARP:p0:X", 0),
XML.getValue("WARP:p0:Y", 0)
@@ -89,12 +86,19 @@ void ofApp::setup(){
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.lifespan=XML.getValue("stars:life",4.0f);
+ stars1.x=XML.getValue("stars1:X",0.0f);
+ stars1.y=XML.getValue("stars1:Y",0.0f);
+ stars1.rate=XML.getValue("stars1:rate",1.0f);
+ stars1.radius=XML.getValue("stars1:radius",100.0f);
+ stars1.speed=XML.getValue("stars1:speed",5.0f);
+ stars1.lifespan=XML.getValue("stars1:life",4.0f);
+
+ stars2.x=XML.getValue("stars2:X",0.0f);
+ stars2.y=XML.getValue("stars2:Y",0.0f);
+ stars2.rate=XML.getValue("stars2:rate",1.0f);
+ stars2.radius=XML.getValue("stars2:radius",100.0f);
+ stars2.speed=XML.getValue("stars2:speed",5.0f);
+ stars2.lifespan=XML.getValue("stars2:life",4.0f);
//stars.init(ofVec2f(2000.0f,2000.0f),100.0f,1.0,5.0,4.0,1.0);
@@ -108,7 +112,7 @@ void ofApp::default_settings(){
warpframe[2]=glm::vec2(outputWindowSize.x,outputWindowSize.y);
warpframe[3]=glm::vec2(0,outputWindowSize.y);
outputPosition=ofPoint(0,0);
- outputScale=1.0f;
+ outputScale=2.0f;
}
void ofApp::save_settings(){
@@ -132,12 +136,23 @@ void ofApp::save_settings(){
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.lifespan);
+ XML.setValue("stars1:X",stars1.x);
+ XML.setValue("stars1:Y",stars1.y);
+ XML.setValue("stars1:rate",stars1.rate);
+ XML.setValue("stars1:radius",stars1.radius);
+ XML.setValue("stars1:speed",stars1.speed);
+ XML.setValue("stars1:life",stars1.lifespan);
+ XML.setValue("stars1:mixprob",stars1.mixprob);
+ XML.setValue("stars1:bRandomise",stars1.bRandomise);
+
+ XML.setValue("stars2:X",stars2.x);
+ XML.setValue("stars2:Y",stars2.y);
+ XML.setValue("stars2:rate",stars2.rate);
+ XML.setValue("stars2:radius",stars2.radius);
+ XML.setValue("stars2:speed",stars2.speed);
+ XML.setValue("stars2:life",stars2.lifespan);
+ XML.setValue("stars2:mixprob",stars2.mixprob);
+ XML.setValue("stars2:bRandomise",stars2.bRandomise);
XML.saveFile("settings.xml");
cout << "settings.xml saved!" <<std::endl;
@@ -145,7 +160,7 @@ void ofApp::save_settings(){
//--------------------------------------------------------------
void ofApp::update(){
- banner.update(text_speed);
+ banner.update(text_speed,true);
laser.set_pts(laser_points);
laser.set_subdivide(laser_subdivide);
@@ -154,7 +169,8 @@ void ofApp::update(){
laser.set_intensity(laser_intensity);
- stars.update();
+ stars1.update();
+ stars2.update();
}
//--------------------------------------------------------------
@@ -164,7 +180,9 @@ void ofApp::draw(){
textgui.draw();
lasergui.draw();
- stars.gui.draw();
+
+ stars1.gui.draw();
+ stars2.gui.draw();
lineTransformer::drawWarpFrame(warpframe);
@@ -218,15 +236,22 @@ void ofApp::draw(){
ofSetColor(255,255,255);
- vector<colourPolyline> laserstars=stars.getPoints();
+ vector<colourPolyline> laserstars;
+ int numstars=0;
+
+ laserstars=stars1.getPoints();
+ num+=laser.draw(laserstars);
+ numstars+=laserstars.size();
- num+=laser.draw(laserstars);
+ laserstars=stars2.getPoints();
+ num+=laser.draw(laserstars);
+ numstars+=laserstars.size();
if (num>0){
- ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(laserstars.size()));
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(numstars));
}
else {
- ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off, stars: "+ofToString(laserstars.size()));
+ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off, stars: "+ofToString(numstars));
}