#pragma once #define IMAGE_STORE_SIZE 256 #define MIN_TILE_SIZE 8 #define MAX_TILE_SIZE 32 #include "ofMain.h" #include "ofxJSONElement.h" long ofToLong(const string& intString); class imageStore : public ofThread{ public: float interval; //time between refreshes in seconds std::string instagram_url; ofxJSONElement response; std::map images; deque to_update; imageStore(){ instagram_url = "https://api.instagram.com/v1/tags/tycleeson/media/recent?client_id=c1d74d701fdf4ddd9f8d30ee9e8f944b"; interval=5.00f; } void set_interval(float _interval){ interval=_interval; } void start(){ startThread(true, false); // blocking, verbose } void stop(){ stopThread(); } //-------------------------- void threadedFunction(){ //1st get the pre-existing images ofDirectory image_path(ofToString(IMAGE_STORE_SIZE)+"/"); cerr<<"image path: "<::iterator i=images.begin();i!=images.end();++i){ if(i->second.isUsingTexture()){ drawcount++; } } //cout<<"loaded "<::iterator i=images.begin();i!=images.end();++i){ if(i->second.isUsingTexture()){ i->second.draw(ofToLong(i->first)%(long)(ofGetWidth()-i->second.getWidth()+1),ofToLong(i->first)%(long)(ofGetHeight()-i->second.getHeight()+1)); } } unlock(); } } };