Exemplo n.º 1
0
//--------------------------------------------------------------
void gFrameApp::tuioUpdated(ofxTuioCursor &cursor)
{
    if(input_tuio)
    {
        GPoint the_point;
        float x,y;
        x = cursor.getX();
        y = cursor.getY();
        
        the_point.setLocation(ofVec2f(x, y));
        the_point.setId(cursor.getFingerId());
        the_point.setStrokeId(cursor.getSessionId());
        the_point.setColor(localBrushColor);
        the_point.setType(TUIO);
        the_point.setStyle(current_style);
        stroke_list.add(the_point);
        
        finger_positions[cursor.getFingerId()] = ofVec2f(x, y);
        //flowfield
        simple_flow.inputUpdate(x, y, cursor.getFingerId());
        simple_flow_2.inputUpdate(x, y, cursor.getFingerId());
        
        ledFrame.stopPulsing();
        ledFrame.updateLastPointsTime();
    }
}
Exemplo n.º 2
0
//call when finger is removed from Ideatable
void testApp::tuioRemoved(ofxTuioCursor & tuioCursor) {
    //remove line which is related to the finger
    for(line_itr=lines.begin(); line_itr!=lines.end(); line_itr++) {
        if((*line_itr).getCursorID()==tuioCursor.getFingerId())
            lines.erase(line_itr);
    }
    prevStatus.erase(tuioCursor.getFingerId());
#ifdef DEBUG
    log="Cursor Removed: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 3
0
//--------------------------------------------------------------
void gFrameApp::tuioRemoved(ofxTuioCursor & cursor)
{
    if(input_tuio)
    {
        finger_positions[cursor.getFingerId()] = ofVec2f(0, 0);
    }
}
Exemplo n.º 4
0
//--------------------------------------------------------------
void ofApp::tuioUpdated(ofxTuioCursor &cursor){
    Finger& f = finger[cursor.getFingerId()];
    
    ofPoint loc = ofPoint(cursor.getX()*ofGetWidth(),cursor.getY()*ofGetHeight());
    
    // save the active value because it will be overwritten after the update
    bool wasActive = f.isActive();

    f.update(loc);
    
    // make a new ray if the speed is high enough, the finger was active and if the finger hasn't triggered anything lately
    if(f.getDirection().length() > triggerSpeed && wasActive && f.getTimeSinceLastTriggered() > triggerTimeout){
        f.triggered();
        ParticleRay r = ParticleRay(f.getPosition(), f.getDirection().scale(particleSpeed));
        
        // check if we need to create a new ray or if an old one can be reused
        // this could very well be coded more efficiently...
        int i = 0;
        for(i = 0; i< rays.size(); i++){
            if(rays[i].isDead()){
                break;
            }
        }
        if(i < rays.size()){
            rays[i] = r;
        } else{
            rays.push_back(r);
        }
    }
    
//    ledFrame.stopPulsing();
    ledFrame.updateLastPointsTime();
}
Exemplo n.º 5
0
void testApp::tuioAdded(ofxTuioCursor& tuioCursor)
{
    log  = " new cursor: ";
	log += ofToString(tuioCursor.getFingerId());
	log += " X: " + ofToString(tuioCursor.getX());
	log += " Y: " + ofToString(tuioCursor.getY());
}
Exemplo n.º 6
0
void testApp::tuioUpdated(ofxTuioCursor& tuioCursor)
{
    log =  " cursor updated: ";
	log += ofToString(tuioCursor.getFingerId());
	log += " X: " + ofToString(tuioCursor.getX());
	log += " Y: " + ofToString(tuioCursor.getY());
}
Exemplo n.º 7
0
void testApp::tuioUpdated(ofxTuioCursor & tuioCursor) {
    //TODO add linemake function and update object
#ifdef DEBUG
    log="Cursor Updated: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 8
0
//call when finger is moved
void testApp::tuioAdded(ofxTuioCursor & tuioCursor) {
    //TODO add function that runs when finger added
#ifdef DEBUG
    log="New Cursor: "+ofToString(tuioCursor.getFingerId())+
        " X: "+ofToString(tuioCursor.getX())+
        " Y: "+ofToString(tuioCursor.getY());
    ofLog()<<log;
#endif
}
Exemplo n.º 9
0
void ofxLayout::tuioUpdated(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0){
        if (touchReady){
            ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
            mouseDraggedPt = ofPoint(loc)*mouseTransformation;
            ofxLayoutElement* mouseDraggedElement = hittest(mouseDraggedPt);
            mouseDraggedElement->fingerDragged(loc);
            string evtStr = "mouseDragged";
            ofNotifyEvent(mouseDraggedEvt, evtStr, mouseDraggedElement);
            ofNotifyEvent(tuioCursorUpdatedEvt, tuioCursor, mouseDraggedElement);
        }
    }
}
Exemplo n.º 10
0
// FINGER ADDED ////////////////////////////////////////////////////////
void testApp::cursorAdded(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wQuadro * tuioCursor.getX();
	pos.y = hQuadro * tuioCursor.getY();
	
	dito = new Finger(finger_id);
	dito_list.push_back(dito);
	dito_list.back()->setup(&pos, blue);
	dito_list.back()->added();
	
	
	
	
}
Exemplo n.º 11
0
void ofxLayout::tuioRemoved(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0)
    {
        ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
        mouseDraggedPt.set(ofPoint());
        mouseReleasedPt = loc*mouseTransformation;
        ofxLayoutElement* mouseReleasedElement = hittest(mouseReleasedPt);
        mouseReleasedElement->fingerReleased(loc);
        string evtStr = "mouseReleased";
        ofNotifyEvent(mouseReleasedEvt, evtStr, mouseReleasedElement);
        ofNotifyEvent(tuioCursorRemovedEvt, tuioCursor, mouseReleasedElement);
        
        touchReadyCheck();
    }
}
Exemplo n.º 12
0
// FINGER REMOVED //////////////////////////////////////////////////////
void testApp::cursorRemoved(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wQuadro * tuioCursor.getX();
	pos.y = hQuadro * tuioCursor.getY();
	
	list<Finger*>::iterator it;
	for (it=dito_list.begin(); it !=dito_list.end(); ++it) 
	{
		if ( (*it)->get_finger_id() == finger_id) 
		{
			(*it)->removed();
			break;
		}
	}
	dito_list.erase(it);
}
Exemplo n.º 13
0
// FINGER UPDATED //////////////////////////////////////////////////////
void testApp::cursorUpdated(ofxTuioCursor & tuioCursor)
{
	int finger_id = tuioCursor.getFingerId();
	pos.x = wFbo * tuioCursor.getX();
	pos.y = hFbo * tuioCursor.getY();
	int x_speed = tuioCursor.getXSpeed();
	int y_speed = tuioCursor.getYSpeed();
	int motion_speed = tuioCursor.getMotionSpeed();
	int motion_accel = tuioCursor.getMotionAccel();
	
	for (list<Finger*>::iterator it=dito_list.begin(); it !=dito_list.end(); ++it) 
	{
		if ( (*it)->get_finger_id() == finger_id) 
		{
			(*it)->update_interrupt(&pos);	
			break;
		}
	}
}
Exemplo n.º 14
0
//--------------------------------------------------------------
void ofApp::tuioAdded(ofxTuioCursor &cursor){
    ofPoint loc = ofPoint(cursor.getX()*ofGetWidth(),cursor.getY()*ofGetHeight());
    finger[cursor.getFingerId()].update(loc);
    
    ledFrame.updateLastPointsTime();
}
Exemplo n.º 15
0
void testApp::tuioUpdated(ofxTuioCursor & tuioCursor){
    //カーソル状態更新
    log =  " cursor updated: " + ofToString(tuioCursor.getFingerId())+
    " X: "+ofToString(tuioCursor.getX())+
    " Y: "+ofToString(tuioCursor.getY());
}
Exemplo n.º 16
0
void testApp::tuioRemoved(ofxTuioCursor & tuioCursor){
    //カーソル削除
    log =  " cursor removed: " + ofToString(tuioCursor.getFingerId())+
    " X: "+ofToString(tuioCursor.getX())+
    " Y: "+ofToString(tuioCursor.getY());
}
Exemplo n.º 17
0
void testApp::tuioAdded(ofxTuioCursor & tuioCursor){
    //カーソル追加
    log = " new cursor: " + ofToString(tuioCursor.getFingerId())+
    " X: "+ofToString(tuioCursor.getX())+
    " Y: "+ofToString(tuioCursor.getY());
}
Exemplo n.º 18
0
//--------------------------------------------------------------
void ofApp::tuioRemoved(ofxTuioCursor &cursor){
    finger[cursor.getFingerId()].deactivate();
}