From 74be885fc585d3865116e353ac13de94a5d688c7 Mon Sep 17 00:00:00 2001 From: tim Date: Sat, 25 Mar 2017 01:11:08 +0000 Subject: add ec2 --- menuApp/src/ofApp.cpp | 109 +++++++------------------------------------------- 1 file changed, 14 insertions(+), 95 deletions(-) (limited to 'menuApp/src/ofApp.cpp') diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp index b1da2ff..d65e7e2 100644 --- a/menuApp/src/ofApp.cpp +++ b/menuApp/src/ofApp.cpp @@ -14,6 +14,7 @@ void ofApp::loadimages(){ { for ( int i = 0; i < min(IMAGE_SLOTS,(int)instagram.getImageURL().size()); i++) { + //if (instagram.getImageURL()!=) getImages.loadFromURL(images[i], instagram.getImageURL()[i]); ofLog(OF_LOG_NOTICE) << instagram.getImageURL()[i]; //images[i].load("images/"+ofToString(i)+".jpg"); @@ -35,31 +36,12 @@ void ofApp::loadimages(){ void ofApp::setup(){ - ofTrueTypeFont::setGlobalDpi(180); - - type14.load("American Typewriter Regular.ttf", 14*FACTOR, true, true); - type14.setLineHeight(18.0f*FACTOR); - type14.setLetterSpacing(1.037*FACTOR); - - /* - bikers.load("images/bikers.jpg"); - gears.load("images/gears.gif"); - tdf.load("images/tdf_1972_poster.jpg"); - - tdfSmall.load("images/tdf_1972_poster.jpg"); - tdfSmall.resize(tdfSmall.getWidth() / 4, tdfSmall.getHeight() / 4); - tdfSmall.setImageType(OF_IMAGE_GRAYSCALE); - - transparency.load("images/transparency.png"); - bikeIcon.load("images/bike_icon.png"); - bikeIcon.setImageType(OF_IMAGE_GRAYSCALE); - */ - + ofTrueTypeFont::setGlobalDpi(150); + myText.init("American Typewriter Regular.ttf", 14*FACTOR, 'i'); background.load("images/background1080.png"); overlay.load("images/overlay1080.png"); - //overlay.setImageType(OF_IMAGE_GRAYSCALE); instagram.setup(hangdaitoken,"self"); instagram.setCertFileLocation(ofToDataPath("ca-bundle.crt",false)); @@ -78,6 +60,7 @@ void ofApp::setup(){ */ //load + ofSetFrameRate(5); } //-------------------------------------------------------------- @@ -88,23 +71,13 @@ void ofApp::update(){ //-------------------------------------------------------------- void ofApp::draw(){ - ofSetColor(255); + ofSetColor(255,255,255); ofPushMatrix(); //Store the coordinate system nexessary for some reason background.draw(0,0,ofGetWidth(),ofGetHeight()); ofPopMatrix(); //Restore the coordinate system - //ofLog(OF_LOG_NOTICE,"background is %fx%f",background.getWidth(),background.getHeight()); -/* - int rowinitialoffset=40; - int colinitialoffset=60; - int rowoffset=520; - int imgsize=480; - int coloffset=603; - int col=0; - int row=0; - int rows=2; -*/ + int colinitialoffset=40; int rowinitialoffset=60; int coloffset=520; @@ -113,9 +86,11 @@ ofPopMatrix(); //Restore the coordinate system int col=0; int row=0; int cols=2; - int textcolinset=40; + int textcolinset=20; int textrowinset=50; + + //some kind of rendering bug with textsuite means it has to go last or everything is dim if (!images.empty()) { for (int i = 0; i < images.size(); i++) { @@ -126,21 +101,11 @@ ofPopMatrix(); //Restore the coordinate system int imgy=(rowinitialoffset+(row*rowoffset))*FACTOR; images[i].draw(imgx,imgy,imgsize*FACTOR,imgsize*FACTOR); std::string caption=instagram.getImageCaption()[i]; - int captionend = caption.find("#"); - if (captionend == std::string::npos){ - captionend=caption.size(); - } - float width=type14.stringWidth(caption.substr(0,captionend)); - ofLog(OF_LOG_NOTICE) << caption.substr(0,captionend) << " <<<<:width: " << width; + myText.setText(caption); + myText.wrapTextX(imgsize*FACTOR); + myText.setColor(255,255,255,255); + myText.drawCenter(imgx+((imgsize*FACTOR)/2),imgy+((imgsize+textcolinset)*FACTOR),2); - vector captions = ofSplitString(caption.substr(0,captionend), " "); - - if (width