From 3f24a2f8f7f05b9200fb0f5341a3fc1139ee7748 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 16 Aug 2022 00:36:53 +0100 Subject: add gui --- lasertext/src/ofApp.h | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) (limited to 'lasertext/src/ofApp.h') diff --git a/lasertext/src/ofApp.h b/lasertext/src/ofApp.h index a15d918..3fcde84 100644 --- a/lasertext/src/ofApp.h +++ b/lasertext/src/ofApp.h @@ -2,6 +2,8 @@ #include "ofMain.h" #include "ofxSvg.h" +#include "ofxGui.h" +#include "ofxXmlSettings.h" #include "ofxHelios.h" #include "colourPolyline.h" @@ -83,6 +85,13 @@ public: } return _w+max((float)(words.size()-1)*enspace,0.0f); } + int glyphCount(){ + int c=0; + for (auto& w:words){ + c+=w.glyphs.size(); + } + return c; + } string text(){ string s; for (auto& w:words) { @@ -170,13 +179,25 @@ public: void clear(){words.clear();} void update(float period=1.0f){ float t=ofGetElapsedTimef()/period; - int theword=int(t)%words.size(); - float segment=t-int(t); + int theword=0; + float segment=0.0f; + if (false){ //1 word per second + theword=int(t)%words.size(); + segment=t-int(t); + } + else { //proportional to #of letters + int theletter=int(t)%glyphCount(); + theword=0; + while((theletter-=words[theword].glyphs.size())>0){ + theword++; + } + segment=(((float)theletter+words[theword].glyphs.size()+t-int(t))/words[theword].glyphs.size()); + } //calculate params for word/letter anim for (int i=0;i laser_power; + ofParameter laser_intensity; + ofParameter laser_points; + ofParameter laser_subdivide; + ofParameter laser_blank_num; + ofParameter laser_max_angle; + + ofxXmlSettings XML; }; -- cgit v1.2.3