Пример #1
0
//--------------------------------------------------------------
void saverScene::update(float mouseX, float mouseY){

	saveAndUpload.setMaxCounter(buttonCount);
	clearTags.setMaxCounter(buttonCount*2);	
	
	mx = mouseX;
	my = mouseY;

	if( saveAndUpload.update(mx, my) ){
		
		checkDirExists();
		
		string timeStr = ofGetTimestampString();
        
		
		string fileName = "temptTag-"+timeStr+".gml";
		
		string fullPath = "tags/gml/"+fileName;
		
		imagePath	    = "tags/images/";
		imageFilename   = "temptTag-"+timeStr+".png";
		
		//add the file name to gml
    /*  gml.saveStateAndFileName(groups.getVector(), fullPath, fileName);
				
		reader.loadGML(fullPath);
		
		if( bUpload )uploader.uploadToWeb(gmlUploadString, reader.xml);
		if( bUpload )grabScreen = true;
     */
	}
	
	if( tmpGroups.size() ){
		if( addTag.update(mx, my) ){
			vector <strokeGroup> & vec = groups.getVector();
			for(int i = 0; i < tmpGroups.size(); i++){
				vec.push_back(tmpGroups[i]);
			}
			tmpGroups.clear();
		}
		if( clearLoaded.update(mx, my) ){
			tmpGroups.clear();
		}
	}
	
	if( loadNext.update(mx, my) ){
		loadNextState();
	}
	
	if( loadPrevious.update(mx, my) ){
		loadPreState();
	}
		
	if( clearTags.update(mx, my) ){
		groups.clear();
		groups.addGroup();	
	}
	
}
Пример #2
0
//--------------------------------------------------------------
void saverScene::draw(){
	ofPushStyle();	

	ofFill();
	
	ofSetHexColor(0xFFFFFF);
	ofRect(SIDE_GUI_X, 0, ofGetWidth(), ofGetHeight());
	
	if( tmpGroups.size() ){
		ofPushStyle();
		ofEnableAlphaBlending();
		addTag.draw(50);
		clearLoaded.draw(50);
		ofPopStyle();
		
	}
	

	renderer.render(groups.getVector());
	renderer.render(tmpGroups);
	
	
	if( grabScreen ){
		ofImage img;
		img.grabScreen(SIDE_GUI_X, 0, ofGetWidth()-SIDE_GUI_X, ofGetHeight());
		img.saveImage(imagePath + imageFilename);
		
		if( !uploadImage(imagePath, imageFilename) ){
			printf("ERROR UPLOADING VIA FTP\n");
		}		
		
		grabScreen = false;
	}

	saveAndUpload.draw();
	clearTags.draw();
	loadPrevious.draw();
	loadNext.draw();
	
			
	if( mx < SIDE_GUI_X ){
		ofPushStyle();
			ofFill();
			ofSetColor(255, 255, 255);
			ofCircle(mx, my, 9);
			ofSetColor(0,0,0);
			ofCircle(mx, my, 6);
		ofPopStyle();
	}
	else{
		ofNoFill();
		ofCircle(mx, my, 9);
	}
	
	
	ofPopStyle();
}
Пример #3
0
//--------------------------------------------------------------
void styleScene::draw() {
    ofPushStyle();

    for(int i = 0; i < drawableButtons.size(); i++) {
        drawableButtons[i]->draw();
    }

    if( groups.size() ) {
        renderer.render(groups.getVector());
        ofPushStyle();
        ofSetLineWidth(1);
        glLineStipple(1, 0x3F07 );
        glEnable( GL_LINE_STIPPLE );
        for(int i = 0; i < groups.size(); i++) {
            if( i == whichGroup || showAll) {
                ofSetColor(160, 160, 160);
                groups[i].drawBoundingRect();
            }
        }
        glDisable(GL_LINE_STIPPLE);
        ofPopStyle();
    }

    ofEnableAlphaBlending();
    if( state == STYLE_LETTER ) {
        selectLeft.draw(50.0);
        selectRight.draw(50.0);
    } else if (state == STYLE_STROKE) {
        strokeUp.draw(50.0);
        strokeDown.draw(50.0);
        pickColor.draw(50.0);
        brush.draw(50.0);
    } else if (state == STYLE_SHADOW) {
        shadowLeft.draw(50.0);
        shadowRight.draw(50.0);
        shadowUp.draw(50.0);
        shadowDown.draw(50.0);
        pickColor.draw(50.0);
        lighting.draw(50.0);
        hashes.draw(50.0);
    } else if (state == STYLE_FILL) {
        toggleFill.draw(75.0);
        toggleHoles.draw(75.0);
        pickColor.draw(50.0);
    } else if (state == STYLE_OUTLINE) {
        outlineUp.draw(50.0);
        outlineDown.draw(50.0);
        pickColor.draw(50.0);
    }

    if (drawColors) {
        ofPushStyle();
        cPicker.draw(pickColor.x + pickColor.width - 6*cPicker.width, pickColor.y+100);
        ofPopStyle();
    }


    if( mx < SIDE_GUI_X ) {
        ofPushStyle();
        ofFill();
        ofSetColor(255, 255, 255);
        ofCircle(mx, my, 9);
        ofSetColor(0,0,0);
        ofCircle(mx, my, 6);
        ofPopStyle();
    }
    else if( testState == BUTTON_NONE ) {
        ofSetColor(0, 0, 0);
        ofNoFill();
        ofCircle(mx, my, 9);
    } else if(testState == BUTTON_STARTED ) {
        ofFill();
        ofCircle(mx, my, 5);
    }

    ofPopStyle();
}