summaryrefslogtreecommitdiff
path: root/menuApp/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'menuApp/src/ofApp.cpp')
-rw-r--r--menuApp/src/ofApp.cpp175
1 files changed, 90 insertions, 85 deletions
diff --git a/menuApp/src/ofApp.cpp b/menuApp/src/ofApp.cpp
index 47e0967..14ce45f 100644
--- a/menuApp/src/ofApp.cpp
+++ b/menuApp/src/ofApp.cpp
@@ -131,9 +131,11 @@ bool ofApp::loadInstagramFeed(){
//--------------------------------------------------------------
void ofApp::setup(){
- //Dirscanner=dirScanner("/home/tim/Dropbox/menugrab");
+ scanner=dirScanner(ofFilePath().getUserHomeDir()+"/Dropbox/menugrab");
- //Dirscanner.scan();
+ scanner.scan();
+
+ player=dirPlayer(&scanner);
/*
std::string str ("€");
@@ -186,96 +188,99 @@ void ofApp::update(){
void ofApp::draw(){
ofSetColor(255,255,255);
- if(ofGetElapsedTimef()-lastPoll>POLL_INTERVAL) {
- loadInstagramFeed();
- }
+ if (!player.draw()){
-ofPushMatrix();
+ if(ofGetElapsedTimef()-lastPoll>POLL_INTERVAL) {
+ loadInstagramFeed();
+ }
- if(ROTATION>0){
- ofTranslate(540*FACTOR,960*FACTOR);
- ofRotate(-ROTATION);
- ofTranslate(-120*FACTOR,-540*FACTOR);
- }
-
-ofPushMatrix(); //Store the coordinate system nexessary for some reason
- background.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight());
-ofPopMatrix(); //Restore the coordinate system
-
- int colinitialoffset=40;
- int rowinitialoffset=60;
- int coloffset=520;
- int imgsize=480;
- int rowoffset=615;
- int col=0;
- int row=0;
- int cols=2;
- int textcolinset=10;
- int textrowinset=50;
+ ofPushMatrix();
-
- //some kind of rendering bug with textsuite means it has to go last or everything is dim
-
- bool imageWaiting=false;
-
- if (!items.empty()) {
- for (int i = 0; i < items.size(); i++) {
-
- if (items[i].image->isAllocated()) {
-
- int imgx=(colinitialoffset+(col*coloffset))*FACTOR;
- int imgy=(rowinitialoffset+(row*rowoffset))*FACTOR;
- items[i].image->draw(imgx,imgy,imgsize*FACTOR,imgsize*FACTOR);
- myText.setText(items[i].caption);
- myText.wrapTextX(imgsize*FACTOR);
- myText.setColor(255,255,255,255);
- myText.drawCenter(imgx+((imgsize*FACTOR)/2),imgy+((imgsize+textcolinset)*FACTOR),2);
-
- myText.setText(items[i].price);
- myText.wrapTextX(imgsize*FACTOR);
- myText.setColor(255,255,255,255);
- myText.drawCenter(imgx+((imgsize*FACTOR)/2),imgy+((imgsize+textcolinset+(FONTSPACING*2))*FACTOR),2);
- }
- else imageWaiting=true;
-
- col++;
- if (col==cols){
- col=0;
- row++;
- }
- }
- }
+ if(ROTATION>0){
+ ofTranslate(540*FACTOR,960*FACTOR);
+ ofRotate(-ROTATION);
+ ofTranslate(-120*FACTOR,-540*FACTOR);
+ }
+
+ ofPushMatrix(); //Store the coordinate system nexessary for some reason
+ background.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight());
+ ofPopMatrix(); //Restore the coordinate system
+
+ int colinitialoffset=40;
+ int rowinitialoffset=60;
+ int coloffset=520;
+ int imgsize=480;
+ int rowoffset=615;
+ int col=0;
+ int row=0;
+ int cols=2;
+ int textcolinset=10;
+ int textrowinset=50;
+
+
+ //some kind of rendering bug with textsuite means it has to go last or everything is dim
+
+ bool imageWaiting=false;
+
+ if (!items.empty()) {
+ for (int i = 0; i < items.size(); i++) {
+
+ if (items[i].image->isAllocated()) {
+
+ int imgx=(colinitialoffset+(col*coloffset))*FACTOR;
+ int imgy=(rowinitialoffset+(row*rowoffset))*FACTOR;
+ items[i].image->draw(imgx,imgy,imgsize*FACTOR,imgsize*FACTOR);
+ myText.setText(items[i].caption);
+ myText.wrapTextX(imgsize*FACTOR);
+ myText.setColor(255,255,255,255);
+ myText.drawCenter(imgx+((imgsize*FACTOR)/2),imgy+((imgsize+textcolinset)*FACTOR),2);
+
+ myText.setText(items[i].price);
+ myText.wrapTextX(imgsize*FACTOR);
+ myText.setColor(255,255,255,255);
+ myText.drawCenter(imgx+((imgsize*FACTOR)/2),imgy+((imgsize+textcolinset+(FONTSPACING*2))*FACTOR),2);
+ }
+ else imageWaiting=true;
+
+ col++;
+ if (col==cols){
+ col=0;
+ row++;
+ }
+ }
+ }
+
+ ofEnableAlphaBlending();
+ overlay.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight()); //don't work on a horiz screen??
+ ofDisableAlphaBlending();
+
+ //for some reason the final is only drawn on the frame AFTER all 5 images become allocated
+ //hence the "primed" mechanism
+ if (primed){
+ ofImage img;
+ //float rotation=ofDegToRad(ROTATION);
+ //int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
+ //int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
+ img.grabScreen(0, 0,1920*FACTOR,1920*FACTOR);
+ if(ROTATION>0){
+ img.rotate90(1);
+ img.crop(860*FACTOR,0,1080*FACTOR,1920*FACTOR);
+ }
+ else {
+ img.crop(0,0,1080*FACTOR,1920*FACTOR);
+ }
+ img.save(SCREENGRABFILEPATH);
+ primed=false;
+ }
- ofEnableAlphaBlending();
- overlay.draw(0,0,1080*FACTOR,1920*FACTOR); //ofGetWidth(),ofGetHeight()); //don't work on a horiz screen??
- ofDisableAlphaBlending();
-
- //for some reason the final is only drawn on the frame AFTER all 5 images become allocated
- //hence the "primed" mechanism
- if (primed){
- ofImage img;
- //float rotation=ofDegToRad(ROTATION);
- //int width=(1920*FACTOR*sin(rotation))+(1080*FACTOR*cos(rotation));
- //int height=(1920*FACTOR*cos(rotation))+(1080*FACTOR*sin(rotation));
- img.grabScreen(0, 0,1920*FACTOR,1920*FACTOR);
- if(ROTATION>0){
- img.rotate90(1);
- img.crop(860*FACTOR,0,1080*FACTOR,1920*FACTOR);
- }
- else {
- img.crop(0,0,1080*FACTOR,1920*FACTOR);
- }
- img.save(SCREENGRABFILEPATH);
- primed=false;
- }
+ if (!isGrabbed&&!imageWaiting) {
+ primed=true;
+ isGrabbed=true;
+ }
- if (!isGrabbed&&!imageWaiting) {
- primed=true;
- isGrabbed=true;
+ ofPopMatrix();
}
-ofPopMatrix();
-
}
//--------------------------------------------------------------