ofxThreadedImageLoader::ofxThreadedImageLoader() 
:ofThread()
{
	num_loading = 0;
	ofAddListener(ofEvents.update, this, &ofxThreadedImageLoader::update);
	ofRegisterURLNotification(this);
}
Ejemplo n.º 2
0
//--------------------------------------------------------------
void testApp::setup(){
    ofRegisterURLNotification(this);

    font.loadFont("frabk.ttf", 48);
    
    ofLoadURLAsync("http://api.wunderground.com/api/c7c1fbefd0d9e77d/geolookup/q/autoip.json", "autoip");
}
Ejemplo n.º 3
0
//--------------------------------------------------------------
void testApp::setup(){
    
    //EXAMPLE URL
    //http://cbk0.google.com/cbk?output=xml&ll=51.494966,-0.146674
    //http://cbk0.google.com/cbk?output=xml&ll=%s,%s
    //
    data_url = "http://cbk0.google.com/cbk?output=xml&ll=40.434006,-79.928601";//long, lat
    
    thumbnail_url = "http://cbk0.google.com/cbk?output=thumbnail&w=640&h=320&panoid=";//width, height, panoid
    
    zoom_url = "http://cbk0.google.com/cbk?output=tile&panoid=%s&zoom=4&x=%s&y=%s";//PID, ZOOM, X, Y
    
    
    ofRegisterURLNotification(this);
    ofLoadURLAsync(data_url);
    loading = true;
    
    
    fbo.allocate(512*12, 512*6, GL_RGB);
    fbo.begin();
    ofClear(0, 0, 0);
    fbo.end();
    sphere.set(1000, 60);
    sphere.setPosition(ofVec3f(0, 0, 0));
    
    sphere.mapTexCoordsFromTexture(fbo.getTextureReference());
    cam.setPosition(0, 0, 0);
    
}
Ejemplo n.º 4
0
// http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets/9/312/161.png
void Tile::load(int x, int y, int z) {

	unsigned __int64 d = powl(2, z);
	x %= d; y %=d;
	x64 = (x<0) ? d+x : x;
	y64 = (y<0) ? d+y : y;
	z64 = z;

 	key = (z64<<32) | (x64<<16) | y64;

	if(cache.count(key)) {
		img.loadImage(cache[key]);
		return;
	}
	img.clear();
	// 
	//name = "v=112&src=app&x="+ofToString(x)+"&s=&y="+ofToString(y)+"&z="+ofToString(z)+"&s=Galileo";
	//url="https://khms1.google.ru/kh/"+name+".png";
	name = ofToString(z)+"/"+ofToString(x)+"/"+ofToString(y);
	url="http://a.tiles.mapbox.com/v3/mapbox.mapbox-streets/"+name+".png";
	
	ofRegisterURLNotification(this);
	cout << url << "\n";
	ofLoadURLAsync(url, ofToString(id)+":"+name);
}
Ejemplo n.º 5
0
void DownloaderTask::setup(){
    ofAddListener(ofEvents().update, this, &DownloaderTask::update);
    downloadURL = "http://10.11.12.13";
    progress = 0;
    ofRegisterURLNotification(this);
    
}
Ejemplo n.º 6
0
//--------------------------------------------------------------
void ofApp::setup(){
	mouseX = 100;
	loading=false;
	ofRegisterURLNotification(this);
	
	//to load synchronously
	//image.load("http://blah.com/img.jpg");
}
Ejemplo n.º 7
0
void ofApp::setup()
{
    //ofDisableArbTex();
	//ofEnableArbTex();
    ofSetFullscreen(true);
	ofSetLogLevel(OF_LOG_SILENT);
    //	ofSetLogLevel(OF_LOG_ERROR);
    //	ofSetLogLevel(OF_LOG_VERBOSE);
	ofSetVerticalSync(true);
	ofBackground(30);
	ofDisableSmoothing();
	ofEnableAlphaBlending();
    ofRegisterURLNotification(this);
    ofSetCircleResolution(10);
	glEnable(GL_DEPTH_TEST);
    
	isKinectAttached = true;
    
    
    gui.setup();
    
	if (isKinectAttached)
        kinectManager.init();
	
	resourceManager.init();
	sceneManager.init(&kinectManager, &resourceManager);
    
    sceneManager.cloudTagMan.buildCloudTags();
	sceneManager.cloudTagMan.updateTags();
    
    isFirstFrame = false;
	isPaused = false;
    
    frameRate = targetframeRate;
    ofSetFrameRate(frameRate);
    
#ifdef CHINESE_CELL
    isLoadingXml = false;
    isNewIndexXml = false;
	isNewTagDataXml = false;
	ofRegisterURLNotification(this);
	timesLoaded = 0;
	isFirstIndexLoad = true;
#endif
}
Ejemplo n.º 8
0
//--------------------------------------------------------------
void ofxTwitter::authorize(const string& consumerKey, const string& consumerSecret) {

    ofLogNotice("ofxTwitter::authorize") << "Authorizing app...";
    oauth.setup("https://api.twitter.com", consumerKey, consumerSecret);

    ofRegisterURLNotification(this);
    ofAddListener(ofEvents().exit,this,&ofxTwitter::appExits);

}
Ejemplo n.º 9
0
void ofxStreetView::setLatLon(double _lat, double _lon){
    if(!bRegister){
        ofRegisterURLNotification(this);
        bRegister = true;
    }
    
    clear();
    data_url = "http://cbk0.google.com/cbk?output=xml&ll="+ofToString(_lat)+","+ofToString(_lon)+"&dm=1";
    ofLoadURLAsync(data_url);
}
//--------------------------------------------------------------
void ofxStreetViewCollector::setLatLon(double _lat, double _lon){
    bNewDataCollected = true;
    if(!bRegister){
        ofRegisterURLNotification(this);
        bRegister = true;
    }
    
    data_url = "http://cbk0.google.com/cbk?output=xml&ll="+ofToString(_lat)+","+ofToString(_lon);
    ofLoadURLAsync(data_url);
}
//--------------------------------------------------------------
bool ofxStreetViewCollector::setPanoId(string _pano_id){
    if(points.count(_pano_id) == 0){
        if(!bRegister){
            ofRegisterURLNotification(this);
            bRegister = true;
        }
        data_url = "http://cbk0.google.com/cbk?output=xml&panoid="+_pano_id;
        ofLoadURLAsync(data_url);
        return true;
    }
    return false;
}
Ejemplo n.º 12
0
void InstagramView::loadProfileImage(){
	ofRegisterURLNotification(this);
	size_t found = _args.profilePictureUrl.find_last_of("/\\");
	string profilePictureFileName = _args.profilePictureUrl.substr(found + 1);
	
	// Before loading check if we already have the file
	ofFile file = ofFile(profilePictureFileName);
	if(file.exists() && Settings::instance()->getCache()){
		initProfileImage(profilePictureFileName);
	}else{
		ofSaveURLAsync(_args.profilePictureUrl, profilePictureFileName);
	}
}
Ejemplo n.º 13
0
void ofxStreetView::setPanoId(string _pano_id){
    if(!bRegister){
        ofRegisterURLNotification(this);
        bRegister = true;
    }
    
    if(_pano_id!=pano_id){
        clear();
        pano_id = _pano_id;
        data_url = "http://cbk0.google.com/cbk?output=xml&panoid="+pano_id+"&dm=1";
        ofLoadURLAsync(data_url);
    }
}
Ejemplo n.º 14
0
Map::Map():
    _tileSize(DEFAULT_TILE_SIZE),
    _maxPending(DEFAULT_MAX_PENDING),
    _maxImagesToCache(DEFAULT_MAX_IMAGES_TO_CACHE),
    _gridPadding(DEFAULT_GRID_PADDING),
    _lastClickTime(0),
    _numDrawnImages(0)
{
    ofRegisterMouseEvents(this);
    ofRegisterKeyEvents(this);
    ofAddListener(ofEvents().update, this, &Map::update);

    ofRegisterURLNotification(this);
}
Ejemplo n.º 15
0
void
ofxQRcode::fetch(const std::string& data, size_t size, size_t margin)
{
  std::stringstream googleChartsQRurl;
  googleChartsQRurl
  << "http://chart.googleapis.com/chart?"   // Google Charts Endpoint
  << "chs=" << size << "x" << size << "&"   // chart size
  << "cht=qr&"                              // chart type: QR Code
  << "chld=L|" << margin << "&"             // Error correction [L,M,Q,H], margin
  << "choe=UTF-8&"                          // Encoding
  << "chl=" << data;                        // QR code data
  
  ofRegisterURLNotification(this);
  ofLoadURLAsync(googleChartsQRurl.str(), "qrcode");
}
Ejemplo n.º 16
0
//--------------------------------------------------------------
void testApp::setup(){
    
    ofRegisterURLNotification( this ) ;
    ofSetVerticalSync( true ) ;
    ofSetLogLevel( OF_LOG_WARNING ) ;
    ofAddListener(httpUtils.newResponseEvent,this,&testApp::newResponse);
	httpUtils.start();
    
    
    ipAddress = "localhost" ; 
    username = "******" ; 
    apiMethod + "lights" ;
    
    setupUI( ) ; 
    

}
Ejemplo n.º 17
0
//--------------------------------------------------------------
void ofApp::setup(){

    ofSetVerticalSync(true);
    ofSetWindowPosition(0, 0);
    ofSetFrameRate(30);

    ofEnableAlphaBlending();
    
    //Initialize place settings
    for (int i=0; i<NUM_CUSTOMERS; i++) {
        arrCustomers[i] = customer(i);
    }
    
    //Set up serial
    serial.setup(0, 9600);
    
	serial.startContinuousRead(false);
	ofAddListener(serial.NEW_MESSAGE,this,&ofApp::onNewMessage);
	
    //Register the curl async response
    ofRegisterURLNotification(this);
    
    //Init the state
    initState();
    
    font32.loadFont("Lato-Light.ttf", 32);
    
    // - - - - - - - - - - - - - - - - VIDEO SYNC! - - - [ SETUP ]- - - - - - - -
   
    
    client.setup(PORT);
    
    videoPlayer.loadMovie("testHAP.mov");
    font250.loadFont("Lato-Light.ttf", 250);
    
    bFULLSCREEN = false;
    bINFO = true;
    bPLAY = false;

    // - - - - - - - - - - - - - - - - -  FACT VIDEO TEST  - - - - - - - - - - - -
    for (int i = 0; i <4; i++)     cVideoTest[i].loadMovie("txtTrayAlpha.mov");
    bTestPlay = false;
    
}
Ejemplo n.º 18
0
//--------------------------------------------------------------
void testApp::setup() {
	ofLog(OF_LOG_NOTICE, "test setup");
	threshold = 32;

	camWidth = 640;
	camHeight = 480;

	cam.initGrabber(640, 480);
	cvImgColor.allocate(camWidth, camHeight);
	cvImgGrayscale.allocate(camWidth, camHeight);

	ofEnableBlendMode(OF_BLENDMODE_ALPHA);

	mouseX = 100;
	loading = false;
	ofRegisterURLNotification(this);

	maskLayers.allocate(camWidth, camHeight);
}
Ejemplo n.º 19
0
//--------------------------------------------------------------
void ofApp::setup(){
    //setup initial ip addresses
    iPadIP = "";
    iPhoneIP = "";
    osxIP = "";
    
    //set framerate
    ofSetFrameRate(24);
    
    //set count
    count = 0;
    
    //set debug and sendosc
    debug = false;
    sendOSC = false;
    
    //setup ui and our first video
    setupUI();
    setupVideo();
    
    //setup osc
    setupOSC();
    
    //hide cursor
    CGDisplayHideCursor(NULL);
    
    //set gotjson
    gotJSON = false;
    
    //set ss
    ss << "No video information received yet" << endl;
    
    //load json
    loadJSON();
    
    ofRegisterURLNotification(this);
    videosDownloaded = 0;

}
Ejemplo n.º 20
0
UIRpiCam::UIRpiCam(){
    width = 2592;
    height = 1944;
    quality = 85;
    sharpness = 0;
    contrast = 0;
    brightness = 50;
    saturation = 0;
    rotation = 0;
    
    exposure = "auto";
    awb = "auto";
    imxfx = "none";
    
    host = "rpi.local";

    bHFlip = false;
    bVFlip = false;
    
    bLoading = false;
    ofRegisterURLNotification(this);
}
Ejemplo n.º 21
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    
    ofSetVerticalSync(true);
    ofSetFrameRate(60);
    
    // for single delivery package
    //ofSetDataPathRoot("./");
    
    
    ofDirectory dir;
    dir.open(ASSEST_VIDOE_FOLDER);
    int numFiles = dir.listDir();
    
    for (int i = 0; i < numFiles; ++i)
    {
        cout << "Path at index [" << i << "] = " << dir.getPath(i) << endl;
        videoPlayers.push_back(new ofxAVFVideoPlayer());
        videoPlayers[i]->loadMovie(dir.getPath(i));
        videoPlayers[i]->setLoopState(OF_LOOP_NORMAL);
        videoPlayers[i]->play();
    }
    
    
    // load video
//    for(int i=0; i<N_VIDEO_PLAYERS; i++) {
//        videoPlayers.push_back(new ofxAVFVideoPlayer());
//        videoPlayers[i]->loadMovie("movies/farm_window.mov");
//        videoPlayers[i]->setLoopState(OF_LOOP_NORMAL);
//    }
    
//    // load images
//    imgBottom = new ofImage();
//    imgTop = new ofImage();
//    
//    imgBottom->loadImage("images/L2.jpg");
//    imgTop->loadImage("images/L1.jpg");
    
    
    // load image using ofxGiantImage
    //imgTopx = new ofxGiantImage();
    //imgTopx->loadImage("images/L1.jpg");
    imgTop = new ofxGiantImage();
    imgBottom = new ofxGiantImage();
    imgBottom->loadImage("images/L2.jpg"); //papaya
    imgTop->loadImage("images/L1.jpg");
    
    imgTopPosters.push_back(imgTop);
    
    // enable trace to file
    //ofLogToFile("myLogFile.txt", true);
    
    // initilization
    videoPause = false;
    imageDisplay = false;
    dbgImg = false;
    isDemoMode = false;
    isUpdateImg = false;
    isDownloadImg = false;
    imgRotateIndex = 0;


#ifdef REMOTE_CONTROL
    ////////////////////////////////////////////////////////
    // Remote UI
    
    RUI_SETUP(); //start server
    RUI_SHARE_PARAM(isDemoMode, ofColor(255,0,0,64));
    
    // SET PARAM GROUPS / COLORS //////////////////////////////////
    RUI_NEW_GROUP("Poster");	//make a new group (optional)
    
    // SHARE A STRING PARAM ////////////////////////////////
    strPoster = " ";
    RUI_SHARE_PARAM(strPoster, ofColor(255,0,0,64));	// you can also set a color on a per-param basis
    //Expose x and y vars to the server, providing a valid slider range
    RUI_SHARE_PARAM(x, 0, ofGetWidth());
    RUI_SHARE_PARAM(y, 0, ofGetHeight());
    
    strUpdateFileDate = "";
    RUI_SHARE_PARAM(strUpdateFileDate);
    
    //share the color param
    //RUI_SHARE_COLOR_PARAM(color);
    
    
    // SET PARAM GROUPS / COLORS //////////////////////////////////
    RUI_NEW_GROUP("Video");	//make a new group (optional)
    
    strFruitPrefix = "今天的苹果好好吃,总共有 ";
    strUnit = " 颗";
    currentAppleAmount = "0";
    RUI_SHARE_PARAM(currentAppleAmount, ofColor(255,0,0,64));	// you can also set a color on a per-param basis
    
    
    // SHARE AN ENUM PARAM ////////////////////////////////
    //build a string list for the UI to show
//    menu = MENU_OPTION_1;
//    string menuItems[] = {"MENU_OPTION_0", "MENU_OPTION_1", "MENU_OPTION_2", "MENU_OPTION_3"};
//    //privide the enum param, loweset enum, highest enum, and the Enum string list
//    RUI_SHARE_ENUM_PARAM(menu, MENU_OPTION_0, MENU_OPTION_3, menuItems);
    
    
    // SHARE A string PARAM to unload it later;
    //this is useful in cases where a variable used to be shared,
    //but its value is now on the xml and you still want it loaded
    //but you dont want it to show on the client interface
    //to do so, you first share the param, then load from XML, then remove the param
    unloadTest = "inited from source";
    RUI_SHARE_PARAM(unloadTest);
    
    //load values from XML, as they were last saved (if they were)
    RUI_LOAD_FROM_XML();
    
    //this efectively removes all remoteUI references to this param
    //but bc it's been loaded from xml in the previous step before,
    //the end result is that you get to load its value from XML
    //but it doesnt show in the client.
    //This is meant to be a way to reduce clutter in the client,
    //allowing you to phase out params that have settled down and dont
    //need further editing, but still allowing you to load its value from the xml.
    RUI_REMOVE_PARAM(unloadTest);
    cout << "unloadTest: '" << unloadTest << "'" << endl;
    
    RUI_WATCH_PARAM(currentMouseX); //this will print the supplied param all the time on screen,
    //useful for debugging
    RUI_GET_INSTANCE()->setBuiltInUiScale(3);
    RUI_GET_INSTANCE()->drawUiWithFontStash("SourceHanSansSC-Light.ttf");

#endif
    
    // load font
    unicodeFont.setup("SourceHanSansSC-Light.ttf", //font file, ttf only
                      1.0,					//lineheight percent
                      1024,					//texture atlas dimension
                      true,					//create mipmaps of the font, useful to scale down the font at smaller sizes
                      8,					//texture atlas element padding, shouldbe >0 if using mipmaps otherwise
                      2.0f					//dpi scaleup, render textures @2x the reso
                      );					//lower res mipmaps wil bleed into each other
    
    
    FZLfont.setup("FZLTZCHJW.ttf", //font file, ttf only
                      1.0,					//lineheight percent
                      1024,					//texture atlas dimension
                      true,					//create mipmaps of the font, useful to scale down the font at smaller sizes
                      8,					//texture atlas element padding, shouldbe >0 if using mipmaps otherwise
                      2.0f					//dpi scaleup, render textures @2x the reso
                      );					//lower res mipmaps wil bleed into each other
    
//    char serverPath[512] = "http://www.vim.org/scripts/download_script.php?src_id=7701"; //TODO: move to url list
//    char filePath[256] = "poster_01.zip";
//    
//    char cmd[1024];
//    sprintf(cmd, "curl -o %s %s", filePath, serverPath);
//    cout << "c md:" << cmd << "\n";
//    
//    //char command[] = "curl -o est.zip http://www.vim.org/scripts/download_script.php?src_id=7701";
//    //char command[] = "wget http://www.openss7.org/repos/tarballs/strx25-0.9.2.1.tar.bz2";
//    int status = system(cmd);
    
    
    initTime = ofGetElapsedTimef();
    initTimeDbg = ofGetElapsedTimef();
    ofRegisterURLNotification(this);
    
    // osc
    oscSender.setup(HOST, SENDPORT);
    oscReceiver.setup(RECVPORT);
    
    // send ready
    msgSend.setAddress("/sync/start/FW_SH_02_HBD_A");
    msgSend.addStringArg("ready");
    oscSender.sendMessage(msgSend);

}
Ejemplo n.º 22
0
//--------------------------------------------------------------
void testApp::setup(){
    //base setup
    ofSetFrameRate(FRAME_RATE);
    ofBackground(100);
	ofTrueTypeFont::setGlobalDpi(72);
    ofRegisterURLNotification(this);
    
    //screen
    screenWidth=192;
    screenHeight=157;
    screenFull=32;
    
    //testing
    overlay.loadImage("intro/overlay.png");
    
    //
    recentPostcards="http://www.ualphabets.com/requests/Madrid/postcards.php";
    recentLetters="http://www.ualphabets.com/requests/Madrid/letters.php";
    currentAlphabet="http://www.ualphabets.com/requests/Madrid/alphabet.php";
 
    info="Info";
    
    //setup of the URLS that need to be loaded
    URLsToLoad[0]=info;
    URLsToLoad[1]=recentPostcards;
    URLsToLoad[2]=recentLetters;
    URLsToLoad[3]=recentPostcards;
    URLsToLoad[4]=currentAlphabet;
    URLsToLoad[5]=recentPostcards;
    
    currentURLNo=0; //first screen to be shown
    currentURL=URLsToLoad[currentURLNo];
    loading= true; //send the first request on start alphabets/postcards/...
    
   
    //setup for intro screens before actual
    loadingResponseDone=false;
    blendInfo=0;
    introLength=4;
    
    //setup for alphabet screen
    counterDrawAlphabet=0;
    alphabetLength=10;
    alphabetTitle.loadImage("intro/intro_currentAlphabet.png");
    
    //setup for postcards and letters screen
    lengthPostcards=8;//in secs
    lengthLetters=10;//in secs
    counterPostcardsAndLetters=0;
    counterNumberPostcards=0;
    lettersTitle.loadImage("intro/intro_titleLetters.png");
    
    postcardsTitle.loadImage("intro/intro_titlePostcards.png");

    
    //the German alphabet
    alphabet[0]="A";
    alphabet[1]="B";
    alphabet[2]="C";
    alphabet[3]="D";
    alphabet[4]="E";
    alphabet[5]="F";
    alphabet[6]="G";
    alphabet[7]="H";
    alphabet[8]="I";
    alphabet[9]="J";
    alphabet[10]="K";
    alphabet[11]="L";
    alphabet[12]="M";
    alphabet[13]="N";
    alphabet[14]="O";
    alphabet[15]="P";
    alphabet[16]="Q";
    alphabet[17]="R";
    alphabet[18]="S";
    alphabet[19]="T";
    alphabet[20]="U";
    alphabet[21]="V";
    alphabet[22]="W";
    alphabet[23]="X";
    alphabet[24]="Y";
    alphabet[25]="Z";
    alphabet[26]="NN";
    alphabet[27]=" ";
    alphabet[28]=",";
    alphabet[29]=".";
    alphabet[30]="!";
    alphabet[31]="?";
    alphabet[32]="0";
    alphabet[33]="1";
    alphabet[34]="2";
    alphabet[35]="3";
    alphabet[36]="4";
    alphabet[37]="5";
    alphabet[38]="6";
    alphabet[39]="7";
    alphabet[40]="8";
    alphabet[41]="9";
    
    
    //send the first request
    if (currentURL!="Info") {
        printf("now \n");
        int id = ofLoadURLAsync(currentURL, "async_req");
    } else {
        printf("%s", currentURL.c_str());
        loadingResponseDone=true;
    }
        
}
Ejemplo n.º 23
0
Wikimapia::Wikimapia(void) {

    ofRegisterURLNotification(this);
    vbo.setMode(OF_PRIMITIVE_POINTS);

}
Ejemplo n.º 24
0
void InstagramView::draw(){

	ofSetHexColor(0xFFFFFF);
	
	// Draw media
	#ifdef TARGET_RASPBERRY_PI
		if(_video.isPlaying()){
			_video.draw(0, 0, ofGetHeight(), ofGetHeight());
	#else
		if(_video.isLoaded() && _video.isInitialized()){
			_video.draw(0, 0, ofGetHeight(), ofGetHeight());
	#endif
	}else if(_image.isAllocated()){
		_image.draw(0, 0, ofGetHeight(), ofGetHeight());
	}
	
	// Draw avatar
	ofPushStyle();
	float avatarX = ofGetHeight() + _margin;
	float avatarY = _margin;
	ofSetHexColor(0xEB545A);
	ofDrawRectangle(avatarX, avatarY, _avatarWidth, _avatarHeight);
	if(_profileImage.isAllocated()){
		ofSetHexColor(0xFFFFFF);
		_profileImage.draw(avatarX + 5, avatarY + 5, _avatarWidth - 10, _avatarHeight - 10);
	}else{
		ofSetHexColor(0x333333);
		ofDrawRectangle(avatarX + 5, avatarY + 5, _avatarWidth - 10, _avatarHeight - 10);
	}
	ofPopStyle();
	
	// Draw username
	ofPushStyle();
	float usernameX = avatarX + _avatarWidth + (_margin / 2.0f);
	float usernameY = avatarY + (_avatarHeight / 2.0f) + 5.0f;
	ofSetHexColor(0xEB545A);
	if(_fontMdBold.isLoaded()){
		string username = "******" + _args.username;
		_fontMdBold.drawString(username, usernameX, usernameY);
	}
	ofPopStyle();
	
	// Draw comment
	ofPushStyle();
	float commentX = avatarX;
	float commentY = avatarY + _avatarHeight + _margin + _fontLgRegular.getSize();
	ofSetHexColor(0x000000);

	if(_fontLgRegular.isLoaded()){
		_fontLgRegular.drawString(_args.caption, commentX, commentY);
	}
	ofPopStyle();
	
	// Draw hashtag
	ofPushStyle();
	string hashtag = "@fablabberlin";
	float hashtagX = commentX;
	float hashtagY = ofGetHeight() - _margin - (_fontMdRegular.getLineHeight() * 2.5f);
	ofSetHexColor(0x61C5EA);
	if(_fontMdBold.isLoaded()){
		_fontMdBold.drawString(hashtag, hashtagX, hashtagY);
	}
	ofPopStyle();
	
	// Draw info
	ofPushStyle();
	string info = "Fab Lab Berlin on Instagram.\nContent? Talk to the lab manager!";
	float infoX = hashtagX;
	float infoY = ofGetHeight() - _margin - _fontMdRegular.getLineHeight();
	ofSetHexColor(0x61C5EA);
	if(_fontMdRegular.isLoaded()){
		_fontMdRegular.drawString(info, infoX, infoY);
	}
	ofPopStyle();
}

void InstagramView::loadImage(){
	ofRegisterURLNotification(this);
	size_t found = _args.imageUrl.find_last_of("/\\");
	string imageFileName = _args.imageUrl.substr(found + 1);
	
	// Uncomment this if caching is not important or filesystem does not support long filenames
	//found = imageFileName.find_first_of("?\\");
	//string fileName = imageFileName.substr(0, found);
	
	// Before loading check if we already have the file
	ofFile file = ofFile(imageFileName);
	if(file.exists() && Settings::instance()->getCache()){
		initImage(imageFileName);
	}else{
		ofSaveURLAsync(_args.imageUrl, imageFileName);
	}
}
Ejemplo n.º 25
0
//--------------------------------------------------------------
void testApp::setup(){
    //base setup
    ofSetFrameRate(FRAME_RATE);
    ofBackground(0);
	ofTrueTypeFont::setGlobalDpi(72);
    ofRegisterURLNotification(this);
    
    //
    recentPostcards="http://www.ualphabets.com/requests/Riga/postcards.php";
    recentLetters="http://www.ualphabets.com/requests/Riga/letters.php";
    currentAlphabet="http://www.ualphabets.com/requests/Riga/alphabet.php";
    info="Info";
    
    
    //setup of the URLS that need to be loaded
    URLsToLoad[0]=info;
    URLsToLoad[1]=recentPostcards;
    URLsToLoad[2]=recentLetters;
    URLsToLoad[3]=recentPostcards;
    URLsToLoad[4]=currentAlphabet;
    URLsToLoad[5]=recentPostcards;
    
    currentURLNo=0; //first screen to be shown
    currentURL=URLsToLoad[currentURLNo];
    loading= true; //send the first request on start alphabets/postcards/...
    
    //setup for intro screens before actual
    counterDrawInfo=0;
    loadingResponseDone=false;
    blendInfo=0;
    introLength=4;
    
    //setup for alphabet screen
    counterDrawAlphabet=0;
    alphabetLength=10;
    alphabetTitle.loadImage("intro/intro_currentAlphabet.png");
    
    //setup for postcards and letters screen
    lengthPostcardsAndLetters=10;//in secs
    counterPostcardsAndLetters=0;
    lettersTitle.loadImage("intro/intro_titleLetters.png");
    postcardsTitle.loadImage("intro/intro_titlePostcards.png");
    
    //the latvian alphabet
    alphabet[0]="A";
    alphabet[1]="LatvA";
    alphabet[2]="B";
    alphabet[3]="C";
    alphabet[4]="LatvC";
    alphabet[5]="D";
    alphabet[6]="E";
    alphabet[7]="LatvE";
    alphabet[8]="F";
    alphabet[9]="G";
    alphabet[10]="LatvG";
    alphabet[11]="H";
    alphabet[12]="I";
    alphabet[13]="LatvI";
    alphabet[14]="J";
    alphabet[15]="K";
    alphabet[16]="LatvK";
    alphabet[17]="L";
    alphabet[18]="LatvL";
    alphabet[19]="M";
    alphabet[20]="N";
    alphabet[21]="LatvN";
    alphabet[22]="O";
    alphabet[23]="P";
    alphabet[24]="R";
    alphabet[25]="S";
    alphabet[26]="LatvS";
    alphabet[27]="T";
    alphabet[28]="U";
    alphabet[29]="LatvU";
    alphabet[30]="V";
    alphabet[31]="Z";
    alphabet[32]="LatvZ";
    alphabet[33]="1";
    alphabet[34]="2";
    alphabet[35]="3";
    alphabet[36]="4";
    alphabet[37]="5";
    alphabet[38]="6";
    alphabet[39]="7";
    alphabet[40]="8";
    alphabet[41]="9";
    
    //images before the actual screens
    imagesIntro[0].loadImage("intro/intro_Title.png");//logo
    imagesIntro[1].loadImage("intro/intro_recentLetters.png");//letters
    imagesIntro[2].loadImage("intro/intro_currAlphabet.png");//alphabet
    imagesIntro[3].loadImage("intro/intro_recentPostcards.png");//postcards
    
    //send the first request
    if (currentURL!="Info") {
        printf("now \n");
        int id = ofLoadURLAsync(currentURL, "async_req");
    } else {
        printf("%s", currentURL.c_str());
        loadingResponseDone=true;
    }
    
}
Ejemplo n.º 26
0
//--------------------------------------------------------------
void ofApp::setup(){
    //base setup
    ofSetFrameRate(FRAME_RATE);
    ofBackground(0);
    ofTrueTypeFont::setGlobalDpi(72);
    ofRegisterURLNotification(this);
    ofHideCursor();
    
    //
    recentPostcards="http://www.ualphabets.com/requests/Aarhus/postcards.php";
    recentLetters="http://www.ualphabets.com/requests/Aarhus/letters.php";
    currentAlphabet="http://www.ualphabets.com/requests/Aarhus/alphabet.php";
    currentQuestion="http://www.ualphabets.com/requests/Riga/connected/question.php";
    
    info="Info";
    
    //setup of the URLS that need to be loaded
    URLsToLoad[0]=info;
    URLsToLoad[1]=currentQuestion;
    URLsToLoad[2]=recentPostcards;
    URLsToLoad[3]=currentAlphabet;
    URLsToLoad[4]=recentPostcards;
    URLsToLoad[5]=recentLetters;
    URLsToLoad[6]=recentPostcards;
    
    currentURLNo=0; //first screen to be shown
    currentURL=URLsToLoad[currentURLNo];
    //loading= true; //send the first request on start alphabets/postcards/...
    
    englishTitleScale=0.8;
    
    switchedFromVideo=false;
    
    //setup for intro screens before actual
    loadingResponseDone=false;
    blendInfo=0;
    introLength=5;
    
    //setup for alphabet screen
    counterDrawAlphabet=0;
    alphabetLength=10;
    counterAlphabetsTitle=0;
    alphabetTitle.loadImage("intro/intro_currentAlphabet.png");
    
    //setup for postcards and letters screen
    lengthPostcards=8;//in secs
    lengthLetters=7;//in secs
    counterPostcardsAndLetters=0;
    counterPostcardsTitle=0;
    counterPostcardsQuestion=0;
    counterLettersTitle=0;
    counterNumberPostcards=0;
    lettersTitle.loadImage("intro/intro_titleLetters.png");
    postcardBlendedIn=0;
    postcardBlendedOut=0;
    
    //changing questions setup
    questions[0].loadImage("questions/questions_english_ -01.png");
    questions[1].loadImage("questions/questions_english_ -02.png");
    questions[2].loadImage("questions/questions_english_ -03.png");
    questions[3].loadImage("questions/questions_english_ -04.png");
    
    currentQuestionNumber=0;
    postcardsTitle.loadImage("intro/intro_titlePostcards.png");
    
    //the latvian alphabet
    alphabet[0]="A";
    alphabet[1]="B";
    alphabet[2]="C";
    alphabet[3]="D";
    alphabet[4]="E";
    alphabet[5]="F";
    alphabet[6]="G";
    alphabet[7]="H";
    alphabet[8]="I";
    alphabet[9]="J";
    alphabet[10]="K";
    alphabet[11]="L";
    alphabet[12]="M";
    alphabet[13]="N";
    alphabet[14]="O";
    alphabet[15]="P";
    alphabet[16]="Q";
    alphabet[17]="R";
    alphabet[18]="S";
    alphabet[19]="T";
    alphabet[20]="U";
    alphabet[21]="V";
    alphabet[22]="W";
    alphabet[23]="X";
    alphabet[24]="Y";
    alphabet[25]="Z";
    alphabet[26]="ae";
    alphabet[27]="danisho";
    alphabet[28]="AAA";
    alphabet[29]=".";
    alphabet[30]="!";
    alphabet[31]="?";
    alphabet[32]="0";
    alphabet[33]="1";
    alphabet[34]="2";
    alphabet[35]="3";
    alphabet[36]="4";
    alphabet[37]="5";
    alphabet[38]="6";
    alphabet[39]="7";
    alphabet[40]="8";
    alphabet[41]="9";
    
    
    //send the first request
    if (currentURL!="Info") {
        printf("now \n");
        int id = ofLoadURLAsync(currentURL, "async_req");
    } else {
        printf("%s", currentURL.c_str());
        loadingResponseDone=true;
    }
}
Ejemplo n.º 27
0
//--------------------------------------------------------------
void testApp::setup(){
    //base setup
    ofSetFrameRate(FRAME_RATE);
    ofBackground(0);
	ofTrueTypeFont::setGlobalDpi(72);
    ofRegisterURLNotification(this);
    
    //
    recentPostcardsBerlin="http://www.ualphabets.com/requests/Berlin/postcards.php";
    recentLettersBerlin="http://www.ualphabets.com/requests/Berlin/letters.php";
    currentAlphabetBerlin="http://www.ualphabets.com/requests/Berlin/alphabet.php";

    recentPostcardsRiga="http://www.ualphabets.com/requests/Riga/connected/postcards.php";
    recentLettersRiga="http://www.ualphabets.com/requests/Riga/connected/letters.php";
    currentAlphabetRiga="http://www.ualphabets.com/requests/Riga/connected/alphabet.php";
    
    currentQuestion="http://www.ualphabets.com/requests/Riga/connected/question.php";
    
    recentPostcards=recentPostcardsBerlin;
    recentLetters=recentLettersBerlin;
    currentAlphabet=currentAlphabetBerlin;
    info="Info";
    
    //setup of the URLS that need to be loaded
    URLsToLoad[0]=info;
    URLsToLoad[1]=currentQuestion;
    URLsToLoad[2]=recentPostcards;
    URLsToLoad[3]=recentLetters;
    URLsToLoad[4]=recentPostcards;
    URLsToLoad[5]=currentAlphabet;
    URLsToLoad[6]=recentPostcards;
    
    currentURLNo=0; //first screen to be shown
    currentURL=URLsToLoad[currentURLNo];
    loading= true; //send the first request on start alphabets/postcards/...
    
    //setup of Riga and Berlin images in lower corners
    berlin.loadImage("intro/intro_Berlin.png");
    riga.loadImage("intro/intro_Riga.png");
    
    //setup for intro screens before actual
    loadingResponseDone=false;
    blendInfo=0;
    introLength=4;
    
    //setup for alphabet screen
    counterDrawAlphabet=0;
    alphabetLength=10;
    alphabetTitle.loadImage("intro/intro_currentAlphabet.png");
    berlinAlphabetLoaded=false;
    
    //setup for postcards and letters screen
    lengthPostcards=8;//in secs
    lengthLetters=10;//in secs
    counterPostcardsAndLetters=0;
    counterNumberPostcards=0;
    lettersTitle.loadImage("intro/intro_titleLetters.png");
    postcardsTitle.loadImage("intro/intro_titlePostcards.png");
    
    //changing questions setup
    questions[0].loadImage("questions/questions_english_ -01.png");
    questions[1].loadImage("questions/questions_english_ -02.png");
    questions[2].loadImage("questions/questions_english_ -03.png");
    questions[3].loadImage("questions/questions_english_ -04.png");
    questions[4].loadImage("questions/questions_english_ -05.png");
    currentQuestionNumber=0;

    
    //the German alphabet
    alphabetGerman[0]="A";
    alphabetGerman[1]="B";
    alphabetGerman[2]="C";
    alphabetGerman[3]="D";
    alphabetGerman[4]="E";
    alphabetGerman[5]="F";
    alphabetGerman[6]="G";
    alphabetGerman[7]="H";
    alphabetGerman[8]="I";
    alphabetGerman[9]="J";
    alphabetGerman[10]="K";
    alphabetGerman[11]="L";
    alphabetGerman[12]="M";
    alphabetGerman[13]="N";
    alphabetGerman[14]="O";
    alphabetGerman[15]="P";
    alphabetGerman[16]="Q";
    alphabetGerman[17]="R";
    alphabetGerman[18]="S";
    alphabetGerman[19]="T";
    alphabetGerman[20]="U";
    alphabetGerman[21]="V";
    alphabetGerman[22]="W";
    alphabetGerman[23]="X";
    alphabetGerman[24]="Y";
    alphabetGerman[25]="Z";
    alphabetGerman[26]="AA";
    alphabetGerman[27]="OO";
    alphabetGerman[28]="UU";
    alphabetGerman[29]=".";
    alphabetGerman[30]="!";
    alphabetGerman[31]="?";
    alphabetGerman[32]="0";
    alphabetGerman[33]="1";
    alphabetGerman[34]="2";
    alphabetGerman[35]="3";
    alphabetGerman[36]="4";
    alphabetGerman[37]="5";
    alphabetGerman[38]="6";
    alphabetGerman[39]="7";
    alphabetGerman[40]="8";
    alphabetGerman[41]="9";
    
    //the latvian alphabet
    alphabetLatvian[0]="A";
    alphabetLatvian[1]="LatvA";
    alphabetLatvian[2]="B";
    alphabetLatvian[3]="C";
    alphabetLatvian[4]="LatvC";
    alphabetLatvian[5]="D";
    alphabetLatvian[6]="E";
    alphabetLatvian[7]="LatvE";
    alphabetLatvian[8]="F";
    alphabetLatvian[9]="G";
    alphabetLatvian[10]="LatvG";
    alphabetLatvian[11]="H";
    alphabetLatvian[12]="I";
    alphabetLatvian[13]="LatvI";
    alphabetLatvian[14]="J";
    alphabetLatvian[15]="K";
    alphabetLatvian[16]="LatvK";
    alphabetLatvian[17]="L";
    alphabetLatvian[18]="LatvL";
    alphabetLatvian[19]="M";
    alphabetLatvian[20]="N";
    alphabetLatvian[21]="LatvN";
    alphabetLatvian[22]="O";
    alphabetLatvian[23]="P";
    alphabetLatvian[24]="R";
    alphabetLatvian[25]="S";
    alphabetLatvian[26]="LatvS";
    alphabetLatvian[27]="T";
    alphabetLatvian[28]="U";
    alphabetLatvian[29]="LatvU";
    alphabetLatvian[30]="V";
    alphabetLatvian[31]="Z";
    alphabetLatvian[32]="LatvZ";
    alphabetLatvian[33]="1";
    alphabetLatvian[34]="2";
    alphabetLatvian[35]="3";
    alphabetLatvian[36]="4";
    alphabetLatvian[37]="5";
    alphabetLatvian[38]="6";
    alphabetLatvian[39]="7";
    alphabetLatvian[40]="8";
    alphabetLatvian[41]="9";
    
    //send the first request
    if (currentURL!="Info") {
        printf("now \n");
        int id = ofLoadURLAsync(currentURL, "async_req");
    } else {
        printf("%s", currentURL.c_str());
        loadingResponseDone=true;
    }
        
}
Ejemplo n.º 28
0
//--------------------------------------------------------------
void ofApp::setup(){
    //base setup
    ofSetFrameRate(FRAME_RATE);
    ofBackground(0);
    ofTrueTypeFont::setGlobalDpi(72);
    ofRegisterURLNotification(this);
    
    syphonServer.setName("Syphon Output");
    
    //size of LED 2
    screenWidth=480;
    screenHeight=288;
    
    //
    recentPostcards="http://www.ualphabets.com/requests/SaoPaulo/postcards.php";
    recentLetters="http://www.ualphabets.com/requests/SaoPaulo/letters.php";
    currentAlphabet="http://www.ualphabets.com/requests/SaoPaulo/alphabet.php";
    currentQuestion="http://www.ualphabets.com/requests/Riga/connected/question.php";
    
    info="Info";
    
    //setup of the URLS that need to be loaded
    URLsToLoad[0]=info;
    URLsToLoad[1]=currentAlphabet;//currentQuestion;
    URLsToLoad[2]=recentPostcards;
    URLsToLoad[3]=recentLetters;
    URLsToLoad[4]=recentPostcards;
    URLsToLoad[5]=currentAlphabet;
    URLsToLoad[6]=recentPostcards;
    
    currentURLNo=0; //first screen to be shown
    currentURL=URLsToLoad[currentURLNo];
    loading= true; //send the first request on start alphabets/postcards/...
    
    
    //setup for intro screens before actual
    loadingResponseDone=false;
    blendInfoFacade=0;
    blendInfoLED2=0;
    introLength=5;
    
    //setup for alphabet screen
    counterDrawAlphabet=0;
    alphabetLength=11.6;
    counterAlphabetsTitle=0;
    alphabetTitleFacade.loadImage("intro_facade/intro_currentAlphabet.png");
    alphabetTitleLED2.loadImage("intro_LED2/intro_currentAlphabet.png");
    
    //setup for postcards and letters screen
    lengthPostcards=12;//in secs
    lengthLetters=8;//in secs
    counterPostcardsAndLetters=0;
    counterPostcardsTitle=0;
    counterPostcardsQuestion=0;
    counterLettersTitle=0;
    counterNumberPostcards=0;
    lettersTitleFacade.loadImage("intro_facade/intro_titleLetters.png");
    lettersTitleLED2.loadImage("intro_LED2/intro_titleLetters.png");
    currImgNo=0;
    
    //changing questions setup
    questionsFacade[0].loadImage("questions_facade/questions_english_-01.png");
    questionsFacade[1].loadImage("questions_facade/questions_english_-02.png");
    questionsFacade[2].loadImage("questions_facade/questions_english_-03.png");
    questionsFacade[3].loadImage("questions_facade/questions_english_-04.png");
    //LED questions
    questionsLED2[0].loadImage("questions_LED2/questions_english_-01.png");
    questionsLED2[1].loadImage("questions_LED2/questions_english_-02.png");
    questionsLED2[2].loadImage("questions_LED2/questions_english_-03.png");
    questionsLED2[3].loadImage("questions_LED2/questions_english_-04.png");
    currentQuestionNumber=0;
    postcardsTitleLED2.loadImage("intro_LED2/intro_titlePostcards.png");
    
    
    //the latvian alphabet
    alphabet[0]="A";
    alphabet[1]="B";
    alphabet[2]="C";
    alphabet[3]="D";
    alphabet[4]="E";
    alphabet[5]="F";
    alphabet[6]="G";
    alphabet[7]="H";
    alphabet[8]="I";
    alphabet[9]="J";
    alphabet[10]="K";
    alphabet[11]="L";
    alphabet[12]="M";
    alphabet[13]="N";
    alphabet[14]="O";
    alphabet[15]="P";
    alphabet[16]="Q";
    alphabet[17]="R";
    alphabet[18]="S";
    alphabet[19]="T";
    alphabet[20]="U";
    alphabet[21]="V";
    alphabet[22]="W";
    alphabet[23]="X";
    alphabet[24]="Y";
    alphabet[25]="Z";
    alphabet[26]="+";
    alphabet[27]="$";
    alphabet[28]=",";
    alphabet[29]=".";
    alphabet[30]="!";
    alphabet[31]="?";
    alphabet[32]="0";
    alphabet[33]="1";
    alphabet[34]="2";
    alphabet[35]="3";
    alphabet[36]="4";
    alphabet[37]="5";
    alphabet[38]="6";
    alphabet[39]="7";
    alphabet[40]="8";
    alphabet[41]="9";
    
    
    //send the first request
    if (currentURL!="Info") {
        printf("now \n");
        int id = ofLoadURLAsync(currentURL, "async_req");
    } else {
        printf("%s", currentURL.c_str());
        loadingResponseDone=true;
    }
    


}