diff options
Diffstat (limited to 'lasertext/src')
| -rw-r--r-- | lasertext/src/ofApp.cpp | 23 | ||||
| -rw-r--r-- | lasertext/src/ofApp.h | 1 | ||||
| -rw-r--r-- | lasertext/src/vectortext.h | 8 |
3 files changed, 25 insertions, 7 deletions
diff --git a/lasertext/src/ofApp.cpp b/lasertext/src/ofApp.cpp index e58e361..b0442bb 100644 --- a/lasertext/src/ofApp.cpp +++ b/lasertext/src/ofApp.cpp @@ -28,6 +28,7 @@ void ofApp::setup(){ //banner.init("Everything Is Going To Be Alright"); banner.init("No Pleasure is Too Guilty"); + override_banner.loadFont("fonts/EMSQwandry.svg"); stars1.init("stars 1",990,10); stars2.init("stars 2",990,205); @@ -161,6 +162,7 @@ void ofApp::save_settings(){ //-------------------------------------------------------------- void ofApp::update(){ banner.update(text_speed,true); + override_banner.update(text_speed,true); laser.set_pts(laser_points); laser.set_subdivide(laser_subdivide); @@ -204,7 +206,14 @@ void ofApp::draw(){ ofMatrix4x4 warp =lineTransformer::getPerspectiveTransformMatrix(src,warpframe); - vector<colourPolyline> shapes = banner.getOutlines(0.08f); //*text_scale); //+(0.02f*sin(ofGetElapsedTimef()*.1f))); + vector<colourPolyline> shapes; + + if (override_banner.firstPass()){ + shapes = override_banner.getOutlines(0.08f); //*text_scale); //+(0.02f*sin(ofGetElapsedTimef()*.1f))); + } + else { + shapes = banner.getOutlines(0.08f); //*text_scale); //+(0.02f*sin(ofGetElapsedTimef()*.1f))); + } ofMatrix4x4 rm = ofMatrix4x4::newIdentityMatrix(); rm.translate(laser_pos_x,laser_pos_y,0); @@ -278,7 +287,7 @@ void ofApp::keyPressed(ofKeyEventArgs &args){ //-------------------------------------------------------------- void ofApp::keyReleased(int key){ - +/* if (key>=' '&&key<='~'){ banner.addGlyph(key); } @@ -286,7 +295,7 @@ void ofApp::keyReleased(int key){ banner.removeGlyph(); } ofLog()<<banner.length()<<" "<<key<<" "<<banner.text(); - +*/ switch(key){ case OF_KEY_UP:{ currentFont=(currentFont+1)%fonts.size(); @@ -299,9 +308,11 @@ void ofApp::keyReleased(int key){ banner.loadFont(fonts.getPath(currentFont)); break; } - } - - switch(key){ + case '1':{ + ofLog()<<"sending test phrase 1"; + override_banner.init("This is my new phrase"); + break; + } case 's':{ save_settings(); break; diff --git a/lasertext/src/ofApp.h b/lasertext/src/ofApp.h index b7e0454..f347b8e 100644 --- a/lasertext/src/ofApp.h +++ b/lasertext/src/ofApp.h @@ -201,6 +201,7 @@ class ofApp : public ofBaseApp{ int currentFont; string displaytext; glyphbanner banner; + glyphbanner override_banner; ofxPanel textgui; ofParameter<float> laser_scale; diff --git a/lasertext/src/vectortext.h b/lasertext/src/vectortext.h index 69ea98c..6fa8acc 100644 --- a/lasertext/src/vectortext.h +++ b/lasertext/src/vectortext.h @@ -213,8 +213,14 @@ public: } } void clear(){words.clear();} + bool firstPass(){ + if(!words.size()) return false; + return playhead<glyphCount(); + } void update(float speed=1.0f,float usePalette=false){ + if(!words.size()) return; + float delta=ofGetElapsedTimef()-lastUpdateTime; lastUpdateTime=ofGetElapsedTimef(); playhead+=delta*speed; @@ -240,7 +246,7 @@ public: //segment=(((float)theletter+words[theword].glyphs.size()+playhead-int(playhead))/words[theword].glyphs.size()); segment=(((float)theletter+playfraction-1)/words[theword].glyphs.size()); - } + } //calculate params for word/letter anim for (int i=0;i<words.size();i++){ words[i].amount=(i==theword?sin(segment*3.14):0); |
