#include "ofApp.h" #include "glew.h" /* what do we want to store/control per letter? */ //-------------------------------------------------------------- void ofApp::setup(){ outputWindowSize=ofPoint(ofGetWidth(),ofGetHeight()); fonts.open("fonts/"); fonts.allowExt("svg"); fonts.listDir(); ofLogNotice()<<"found "< 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); rm.scale(laser_scale,laser_scale,laser_scale); rm.translate(outputWindowSize.x/2,outputWindowSize.y/2,0); vector warpedOutput; vector warpedScaledOutput; for (auto s:shapes){ warpedOutput.push_back(lineTransformer::polyLineTransform(warp,s)); } for (auto s:warpedOutput){ warpedScaledOutput.push_back(lineTransformer::polyLineTransform(rm,s)); } int num = 0; if (laser_power&&shapes.size()) num=laser.draw(warpedScaledOutput); //banner.draw(); ofPushMatrix(); ofTranslate(ofGetWidth()/2,ofGetHeight()/2); //ofScale(0.05,-0.05,0.05); for (auto& s: warpedOutput) s.draw(); ofPopMatrix(); ofSetColor(255,255,255); vector starshapes=stars.getPoints(); int numstars=0; for (auto& s: starshapes) { numstars+=s.size(); s.draw(); } num+=laser.draw(starshapes); if (num>0){ ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser points: "+ofToString(num)+", stars: "+ofToString(numstars)); } else { ofSetWindowTitle(ofToString(ofGetFrameRate(), 2)+" fps laser power off, stars: "+ofToString(numstars)); } } //-------------------------------------------------------------- void ofApp::exit() { } //-------------------------------------------------------------- void ofApp::keyPressed(ofKeyEventArgs &args){ } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ /* if (key>=' '&&key<='~'){ banner.addGlyph(key); } else if (key==OF_KEY_BACKSPACE||key==OF_KEY_DEL) { //DEL banner.removeGlyph(); } ofLog()<-1){ warpframe[select_warpframe]=glm::vec2(x,y); } } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ for (int i=0;i<4;i++){ if (ofPoint(x,y).distance(warpframe[i])<25){ select_warpframe=i; } } } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ select_warpframe=-1; } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ }