From 6ae491eea38055ebe3ba1154f0e916d7bbf95040 Mon Sep 17 00:00:00 2001 From: tim Date: Mon, 22 May 2017 21:31:33 +0100 Subject: directory reader in test case --- testDir/src/dirscanner.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 testDir/src/dirscanner.h (limited to 'testDir/src/dirscanner.h') diff --git a/testDir/src/dirscanner.h b/testDir/src/dirscanner.h new file mode 100644 index 0000000..f78c6d5 --- /dev/null +++ b/testDir/src/dirscanner.h @@ -0,0 +1,58 @@ +#pragma once + +#include "ofMain.h" + +class timeSlot { + public: + timeSlot(std::string _p,int _s,int _e){ + path=_p; + start=_s; + end=_e; + } + string path; + int start; + int end; +}; + +class playItem { + public: + playItem(std::string _n){ + filename=_n; + } + string filename; + ofImage image; + ofVideoPlayer video; + void play(); + void draw(); + bool isFinished(); + float startTime; +}; + +class dirScanner { + //todo: compare each item in vector for reload + public: + dirScanner(std::string _d=""){ + rootdir=_d; + } + int getSlotForTime(); + string rootdir; + void scan(); + vector slots; +}; + +class dirPlayer { + public: + dirPlayer(){ + currentslot=-1; + } + dirPlayer(dirScanner *_s){ + scanner=_s; + dirPlayer(); + } + vector items; + string playdir; + int currentslot; + dirScanner *scanner; + void load(); + void draw(); +}; \ No newline at end of file -- cgit v1.2.3 From e49c8555552c76b526a798f16ec5327fe443141a Mon Sep 17 00:00:00 2001 From: tim Date: Thu, 25 May 2017 00:21:51 +0100 Subject: load logic --- testDir/src/dirscanner.cpp | 28 ++++++++++++++++++++++++---- testDir/src/dirscanner.h | 8 +++++++- 2 files changed, 31 insertions(+), 5 deletions(-) (limited to 'testDir/src/dirscanner.h') diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index feb29c1..fc233d5 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -2,6 +2,12 @@ void playItem::play(){ +} +bool playItem::load(string filename){ + ofFile file(filename); + string ext=file.getExtension(); + ofLogNotice() << "item "<-1){ ofLogNotice() << "entering slot "<slots[slot].path; + load(scanner->slots[slot].path); } else { - ofLogNotice() << "leaving slots"; + ofLogNotice() << "leaving slot"; } currentslot=slot; } diff --git a/testDir/src/dirscanner.h b/testDir/src/dirscanner.h index f78c6d5..dfc0847 100644 --- a/testDir/src/dirscanner.h +++ b/testDir/src/dirscanner.h @@ -16,12 +16,18 @@ class timeSlot { class playItem { public: + playItem(){ + loaded=0; + } playItem(std::string _n){ filename=_n; + playItem(); } string filename; ofImage image; ofVideoPlayer video; + int loaded; //0- none, 1- image, 2- mov + bool load(string filename); void play(); void draw(); bool isFinished(); @@ -53,6 +59,6 @@ class dirPlayer { string playdir; int currentslot; dirScanner *scanner; - void load(); + void load(std::string path); void draw(); }; \ No newline at end of file -- cgit v1.2.3 From a0e8fefd1bf241b805c4542421bdbc6a4447fdc3 Mon Sep 17 00:00:00 2001 From: tim Date: Tue, 30 May 2017 00:50:56 +0100 Subject: no alpha or movs --- testDir/src/dirscanner.cpp | 47 +++++++++++++++++++++++++++++++++++++--------- testDir/src/dirscanner.h | 4 +++- testDir/src/main.cpp | 4 ++-- testDir/src/ofApp.cpp | 3 +-- 4 files changed, 44 insertions(+), 14 deletions(-) (limited to 'testDir/src/dirscanner.h') diff --git a/testDir/src/dirscanner.cpp b/testDir/src/dirscanner.cpp index 34dec9b..f3aa974 100644 --- a/testDir/src/dirscanner.cpp +++ b/testDir/src/dirscanner.cpp @@ -1,9 +1,17 @@ #include "dirscanner.h" void playItem::play(){ - + if (video.isLoaded()){ + video.play(); + ofLogNotice() << "playing video: "<0; } void playItem::draw(){ + if (image.isAllocated()){ -} -bool playItem::isFinished(){ + //ofEnableAlphaBlending(); + //ofSetColor(255,255,255,1.0); + image.draw(0,0); + //ofDisableAlphaBlending(); + if (ofGetElapsedTimef()-startTime>5.0){ + isFinished=true; + } + } + if (video.isLoaded()){ + video.draw(0,0); + if (video.getIsMovieDone()){ + isFinished=true; + } + } } void dirScanner::scan(){ @@ -45,7 +66,7 @@ void dirScanner::scan(){ int start = ofToInt(d.substr(0,4)); int end = ofToInt(d.substr(5,4)); - if (start&&end){ + if (end){ slots.push_back(timeSlot(dir.getPath(i),start,end)); ofLogNotice() << "directory "<