当前位置: 首页>>代码示例>>C++>>正文


C++ TuioCursor::getCursorID方法代码示例

本文整理汇总了C++中TuioCursor::getCursorID方法的典型用法代码示例。如果您正苦于以下问题:C++ TuioCursor::getCursorID方法的具体用法?C++ TuioCursor::getCursorID怎么用?C++ TuioCursor::getCursorID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TuioCursor的用法示例。


在下文中一共展示了TuioCursor::getCursorID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: addTuioCursor

TuioCursor* TuioServer::addTuioCursor(float x, float y, float z) {
    sessionID++;

    int cursorID = (int)cursorList.size();
    if (((int)(cursorList.size())<=maxCursorID) && ((int)(freeCursorList.size())>0)) {
        std::list<TuioCursor*>::iterator closestCursor = freeCursorList.begin();

        for(std::list<TuioCursor*>::iterator iter = freeCursorList.begin(); iter!= freeCursorList.end(); iter++) {
            if((*iter)->getDistance(x,y,z)<(*closestCursor)->getDistance(x,y,z)) closestCursor = iter;
        }

        TuioCursor *freeCursor = (*closestCursor);
        cursorID = (*closestCursor)->getCursorID();
        freeCursorList.erase(closestCursor);
        delete freeCursor;
    } else maxCursorID = cursorID;

    TuioCursor *tcur = new TuioCursor(currentFrameTime, sessionID, cursorID, x, y, z);
    cursorList.push_back(tcur);
    updateCursor = true;

    if (verbose) {
        if (mode3d) {
            std::cout << "add cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() << " " << tcur->getZ() << std::endl;
        } else {
            std::cout << "add cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() << std::endl;
        }
    }

    return tcur;
}
开发者ID:zhuangfangwang,项目名称:KinectTouch-libfreenect,代码行数:31,代码来源:TuioServer.cpp

示例2: tuioCursorUpdated

void testApp::tuioCursorUpdated(TuioCursor & tcur){
	cout << " cursor updated: " + ofToString(tcur.getCursorID())+
	 " X: "+ofToString(tcur.getXSpeed())+
	 " Y: "+ofToString(tcur.getYSpeed())
	 << endl;
	updateDB(tcur.getCursorID(), time(NULL), tcur.getX(), tcur.getY());

	//forward the touch events to ofxMultiTouch for the InteractiveObjects
//	ofxMultiTouch.touchMoved(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:CadeLaRen,项目名称:Interplay-2.0,代码行数:10,代码来源:tuioToSql.cpp

示例3: tuioCursorAdded

void testApp::tuioCursorAdded(TuioCursor & tcur){
	cout << " cursor added: " + ofToString(tcur.getCursorID())+
	" X: "+ofToString(tcur.getX())+
	" Y: "+ofToString(tcur.getY())
	<< endl;

//	cout << ofToString(touch.id) << ofToString((int)time(NULL)) << ofToString(touch.x) << endl;
	updateDB(tcur.getCursorID(), time(NULL), tcur.getX(), tcur.getY());
	//forward the touch events to ofxMultiTouch for the InteractiveObjects
//	ofxMultiTouch.touchDown(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:CadeLaRen,项目名称:Interplay-2.0,代码行数:11,代码来源:tuioToSql.cpp

示例4: tuioCursorRemoved

void testApp::tuioCursorRemoved(TuioCursor & tcur){
	/*cout << " cursor removed: " + ofToString(tcur.getCursorID())+
	 " X: "+ofToString(tcur.getX())+
	 " Y: "+ofToString(tcur.getY())
	 << endl;*/
	
	mtActionsHub.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
	mtSliderHub.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
	
	//draggableRotatableScalableItem.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);

	//forward the touch events to ofxMultiTouch for the InteractiveObjects
	ofxMultiTouch.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:naychrist,项目名称:ofxMultiTouchActions_example,代码行数:14,代码来源:testApp.cpp

示例5: addTuioCursor

TuioCursor* TuioManager::addTuioCursor(float x, float y) {
	sessionID++;
	
	int cursorID = (int)cursorList.size();
	if ((int)(cursorList.size())<=maxCursorID) {
		std::list<TuioCursor*>::iterator closestCursor = freeCursorList.begin();
		
		for(std::list<TuioCursor*>::iterator iter = freeCursorList.begin();iter!= freeCursorList.end(); iter++) {
			if((*iter)->getDistance(x,y)<(*closestCursor)->getDistance(x,y)) closestCursor = iter;
		}
		
		TuioCursor *freeCursor = (*closestCursor);
		cursorID = (*closestCursor)->getCursorID();
		freeCursorList.erase(closestCursor);
		delete freeCursor;
	} else maxCursorID = cursorID;	
	
	TuioCursor *tcur = new TuioCursor(currentFrameTime, sessionID, cursorID, x, y);
	cursorList.push_back(tcur);
	updateCursor = true;

	for (std::list<TuioListener*>::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++)
		(*listener)->addTuioCursor(tcur);
	
	if (verbose) 
		std::cout << "add cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() << std::endl;

	return tcur;
}
开发者ID:030ii,项目名称:Multitouch-Hockey-Game,代码行数:29,代码来源:TuioManager.cpp

示例6: removeTuioCursor

void TuioServer::removeTuioCursor(TuioCursor *tcur) {
	if (tcur==NULL) return;
	cursorList.remove(tcur);
	tcur->remove(currentFrameTime);
	updateCursor = true;

	if (verbose)
		std::cout << "del cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ")" << std::endl;

	if (tcur->getCursorID()==maxFingerID) {
		maxFingerID = -1;
		delete tcur;
		
		if (cursorList.size()>0) {
			std::list<TuioCursor*>::iterator clist;
			for (clist=cursorList.begin(); clist != cursorList.end(); clist++) {
				int fingerID = (*clist)->getCursorID();
				if (fingerID>maxFingerID) maxFingerID=fingerID;
			}
			
			std::list<TuioCursor*>::iterator flist;
			for (flist=freeCursorList.begin(); flist != freeCursorList.end(); flist++) {
				TuioCursor *freeCursor = (*flist);
				if (freeCursor->getCursorID()>maxFingerID) delete freeCursor;
				else freeCursorBuffer.push_back(freeCursor);
			}
			
			freeCursorList = freeCursorBuffer;
			freeCursorBuffer.clear();
		} 
	} else if (tcur->getCursorID()<maxFingerID) freeCursorList.push_back(tcur);	
}
开发者ID:fajran,项目名称:multitouch-water-simulation,代码行数:32,代码来源:TuioServer.cpp

示例7: tuioCursorRemoved

void testApp::tuioCursorRemoved(TuioCursor & tcur){
	/*cout << " cursor removed: " + ofToString(tcur.getCursorID())+
	 " X: "+ofToString(tcur.getX())+
	 " Y: "+ofToString(tcur.getY())
	 << endl;*/
	
	//forward the touch events to ofxMultiTouch for the InteractiveObjects
	ofxMultiTouch.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:brolin,项目名称:openFrameworks,代码行数:9,代码来源:testApp.cpp

示例8: tuioCursorRemoved

void testApp::tuioCursorRemoved(TuioCursor & tcur){
//	cout << " cursor removed: " + ofToString(tcur.getCursorID())+
//	 " X: "+ofToString(tcur.getX())+
//	 " Y: "+ofToString(tcur.getY())
//	 << endl;
	updateDB(tcur.getCursorID(), time(NULL), tcur.getX(), tcur.getY());

	//forward the touch events to ofxMultiTouch for the InteractiveObjects
//	ofxMultiTouch.touchUp(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:CadeLaRen,项目名称:Interplay-2.0,代码行数:10,代码来源:tuioToSql.cpp

示例9: stopUntouchedMovingCursors

void TuioServer::stopUntouchedMovingCursors() {

    std::list<TuioCursor*> untouched;
    for (std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin(); tuioCursor!=cursorList.end(); tuioCursor++) {
        TuioCursor *tcur = (*tuioCursor);
        if ((tcur->getTuioTime()!=currentFrameTime) && (tcur->isMoving())) {
            tcur->stop(currentFrameTime);
            updateCursor = true;
            if (verbose) {
                if (mode3d) {
                    std::cout << "set cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() << " " << tcur->getZ()
                              << " " << tcur->getXSpeed() << " " << tcur->getYSpeed()<< " " << tcur->getZSpeed()<< " " << tcur->getMotionAccel() << " " << std::endl;
                } else {
                    std::cout << "set cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY()
                              << " " << tcur->getXSpeed() << " " << tcur->getYSpeed()<< " " << tcur->getMotionAccel() << " " << std::endl;
                }
            }
        }
    }
}
开发者ID:zhuangfangwang,项目名称:KinectTouch-libfreenect,代码行数:20,代码来源:TuioServer.cpp

示例10: tuioCursorUpdated

void testApp::tuioCursorUpdated(TuioCursor & tcur){
	/*cout << " cursor updated: " + ofToString(tcur.getCursorID())+
	 " X: "+ofToString(tcur.getXSpeed())+
	 " Y: "+ofToString(tcur.getYSpeed())
	 << endl;*/
	
	ofxMultiTouchCustomDataSF multiTouchCustomData;
	multiTouchCustomData.sessionID = tcur.getSessionID();
	
	mtActionsHub.touchMoved(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
	mtSliderHub.touchMoved(tcur.getX(), tcur.getY(), tcur.getCursorID(), &multiTouchCustomData);
	/*
	draggableRotatableScalableItem.touchMoved(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
	if(draggableRotatableScalableItem.ownTouchCursor(tcur.getSessionID())) {
		return;
	}
	*/
	//forward the touch events to ofxMultiTouch for the InteractiveObjects
	ofxMultiTouch.touchMoved(tcur.getX(), tcur.getY(), tcur.getCursorID(), NULL);
}
开发者ID:naychrist,项目名称:ofxMultiTouchActions_example,代码行数:20,代码来源:testApp.cpp

示例11: updateTuio

void TuioKinect::updateTuio() {
	TuioTime frameTime = TuioTime::getSessionTime();
	tuioServer->initFrame(frameTime);

	std::vector<ofxCvBlob>::iterator blob;
//	printf("Blobs: %d\n", contourFinder.blobs.size());
	for (blob=contourFinder.blobs.begin(); blob!= contourFinder.blobs.end(); blob++) {
		float xpos = (*blob).centroid.x;
		float ypos = (*blob).centroid.y;

		TuioPoint tp(xpos/kinect.width,ypos/kinect.height);

		//if ((tp.getY() > 0.8) && (tp.getX()>0.25) && (tp.getX()<0.75)) continue;

		TuioCursor *tcur = tuioServer->getClosestTuioCursor(tp.getX(),tp.getY());
		if ((tcur==NULL) || (tcur->getDistance(&tp)>0.2)) {
			tcur = tuioServer->addTuioCursor(tp.getX(), tp.getY());
			updateKalman(tcur->getCursorID(),tcur);

		} else {
			TuioPoint kp = updateKalman(tcur->getCursorID(),tp);
			tuioServer->updateTuioCursor(tcur, kp.getX(), kp.getY());

		}
	}

	tuioServer->stopUntouchedMovingCursors();

	std::list<TuioCursor*> dead_cursor_list = tuioServer->getUntouchedCursors();
	std::list<TuioCursor*>::iterator dead_cursor;
	for (dead_cursor=dead_cursor_list.begin(); dead_cursor!= dead_cursor_list.end(); dead_cursor++) {
		clearKalman((*dead_cursor)->getCursorID());

	}

	tuioServer->removeUntouchedStoppedCursors();
	tuioServer->commitFrame();
}
开发者ID:HellicarAndLewis,项目名称:MulticolouredMagic,代码行数:38,代码来源:TuioKinect.cpp

示例12: drawCursors

void ofxTuioClient::drawCursors(){
    std::list<TuioCursor*> cursorList = client->getTuioCursors();
	std::list<TuioCursor*>::iterator tit;
	client->lockCursorList();
	for (tit=cursorList.begin(); tit != cursorList.end(); tit++) {
		TuioCursor * cur = (*tit);
		//if(tcur!=0){
			//TuioCursor cur = *tcur;
			glColor3f(0.0,0.0,0.0);
			ofEllipse(cur->getX()*ofGetWidth(), cur->getY()*ofGetHeight(), 10.0, 10.0);
			string str = "SessionId: "+ofToString((int)(cur->getSessionID()));
			ofDrawBitmapString(str, cur->getX()*ofGetWidth()-10.0, cur->getY()*ofGetHeight()+25.0);
			str = "CursorId: "+ofToString((int)(cur->getCursorID()));
			ofDrawBitmapString(str, cur->getX()*ofGetWidth()-10.0, cur->getY()*ofGetHeight()+40.0);
		//}
	}
	client->unlockCursorList();
}
开发者ID:lzsngr,项目名称:Paracosm,代码行数:18,代码来源:ofxTuioClient.cpp

示例13: removeTuioCursor

void TuioManager::removeTuioCursor(TuioCursor *tcur) {
	if (tcur==NULL) return;

	if (verbose && tcur->getTuioState()!=TUIO_ADDED)
		std::cout << "del cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ")" << std::endl;
	
	cursorList.remove(tcur);
	tcur->remove(currentFrameTime);
	updateCursor = true;

	for (std::list<TuioListener*>::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++)
		(*listener)->removeTuioCursor(tcur);

	if (tcur->getCursorID()==maxCursorID) {
		maxCursorID = -1;
		delete tcur;
		
		if (cursorList.size()>0) {
			std::list<TuioCursor*>::iterator clist;
			for (clist=cursorList.begin(); clist != cursorList.end(); clist++) {
				int cursorID = (*clist)->getCursorID();
				if (cursorID>maxCursorID) maxCursorID=cursorID;
			}
			
			freeCursorBuffer.clear();
			for (std::list<TuioCursor*>::iterator flist=freeCursorList.begin(); flist != freeCursorList.end(); flist++) {
				TuioCursor *freeCursor = (*flist);
				if (freeCursor->getCursorID()>maxCursorID) delete freeCursor;
				else freeCursorBuffer.push_back(freeCursor);
			}
			
			freeCursorList = freeCursorBuffer;

		} else {
			for (std::list<TuioCursor*>::iterator flist=freeCursorList.begin(); flist != freeCursorList.end(); flist++) {
				TuioCursor *freeCursor = (*flist);
				delete freeCursor;
			}
			freeCursorList.clear();
		}
	} else if (tcur->getCursorID()<maxCursorID) {
		freeCursorList.push_back(tcur);	
	}
}
开发者ID:mkalten,项目名称:reacTIVision,代码行数:44,代码来源:TuioManager.cpp

示例14: removeTuioCursor

void TUIOInputModule::removeTuioCursor(TuioCursor *tcur) {
	std::vector<TouchInfo> touches;	
	std::list<TuioCursor*> cursorList = tuioClient->getTuioCursors();
	tuioClient->lockCursorList();
	for (std::list<TuioCursor*>::iterator iter = cursorList.begin(); iter!=cursorList.end(); iter++) {
			TuioCursor *tuioCursor = (*iter);	
			TouchInfo touch;	
			touch.position.x = tuioCursor->getX();
			touch.position.y = tuioCursor->getY();
			touch.id= tuioCursor->getCursorID();			
			touches.push_back(touch);
	}
	tuioClient->unlockCursorList();	
	TUIOEvent event;
	event.type = InputEvent::EVENT_TOUCHES_ENDED;
	event.touches = touches;
	
	CoreServices::getInstance()->getCore()->lockMutex(eventMutex);
	events.push_back(event);					
	CoreServices::getInstance()->getCore()->unlockMutex(eventMutex);
}
开发者ID:dannywarren,项目名称:Polycode,代码行数:21,代码来源:TUIOInputModule.cpp

示例15: drawObjects

void TuioDemo::drawObjects() {
	glClear(GL_COLOR_BUFFER_BIT);
	char id[3];
	
	// draw the cursors
	std::list<TuioCursor*> cursorList = tuioClient->getTuioCursors();
	tuioClient->lockCursorList();
	for (std::list<TuioCursor*>::iterator iter = cursorList.begin(); iter!=cursorList.end(); iter++) {
		TuioCursor *tuioCursor = (*iter);
		std::list<TuioPoint> path = tuioCursor->getPath();
		if (path.size()>0) {
			
			TuioPoint last_point = path.front();
			glBegin(GL_LINES);
			glColor3f(0.0, 0.0, 1.0);
			
			for (std::list<TuioPoint>::iterator point = path.begin(); point!=path.end(); point++) {
				glVertex3f(last_point.getScreenX(width), last_point.getScreenY(height), 0.0f);
				glVertex3f(point->getScreenX(width), point->getScreenY(height), 0.0f);
				last_point.update(point->getX(),point->getY());
			} glEnd();
			
			// draw the finger tip
			glColor3f(0.75, 0.75, 0.75);
			glPushMatrix();
			glTranslatef(last_point.getScreenX(width), last_point.getScreenY(height), 0.0);
			glBegin(GL_TRIANGLE_FAN);
			for(double a = 0.0f; a <= 2*M_PI; a += 0.2f) {
				glVertex2d(cos(a) * height/100.0f, sin(a) * height/100.0f);
			} glEnd();
			glPopMatrix();
			
			glColor3f(0.0, 0.0, 0.0);
			glRasterPos2f(tuioCursor->getScreenX(width),tuioCursor->getScreenY(height));
			sprintf(id,"%d",tuioCursor->getCursorID());
			drawString(id);
		}
	}
	tuioClient->unlockCursorList();
	
	// draw the objects
	std::list<TuioObject*> objectList = tuioClient->getTuioObjects();
	tuioClient->lockObjectList();
	for (std::list<TuioObject*>::iterator iter = objectList.begin(); iter!=objectList.end(); iter++) {
		TuioObject *tuioObject = (*iter);
		int pos_size = height/25.0f;
		int neg_size = -1*pos_size;
		float xpos  = tuioObject->getScreenX(width);
		float ypos  = tuioObject->getScreenY(height);
		float angle = tuioObject->getAngleDegrees();
		
		glColor3f(0.0, 0.0, 0.0);
		glPushMatrix();
		glTranslatef(xpos, ypos, 0.0);
		glRotatef(angle, 0.0, 0.0, 1.0);
		glBegin(GL_QUADS);
		glVertex2f(neg_size, neg_size);
		glVertex2f(neg_size, pos_size);
		glVertex2f(pos_size, pos_size);
		glVertex2f(pos_size, neg_size);
		glEnd();
		glPopMatrix();
		
		glColor3f(1.0, 1.0, 1.0);
		glRasterPos2f(xpos,ypos+5);
		sprintf(id,"%d",tuioObject->getSymbolID());
		drawString(id);
	}
	tuioClient->unlockObjectList();
	
	// draw the blobs
	std::list<TuioBlob*> blobList = tuioClient->getTuioBlobs();
	tuioClient->lockBlobList();
	for (std::list<TuioBlob*>::iterator iter = blobList.begin(); iter!=blobList.end(); iter++) {
		TuioBlob *tuioBlob = (*iter);
		float blob_width = tuioBlob->getScreenWidth(width)/2;
		float blob_height = tuioBlob->getScreenHeight(height)/2;
		float xpos  = tuioBlob->getScreenX(width);
		float ypos  = tuioBlob->getScreenY(height);
		float angle = tuioBlob->getAngleDegrees();
		
		glColor3f(0.25, 0.25, 0.25);
		glPushMatrix();
		glTranslatef(xpos, ypos, 0.0);
		glRotatef(angle, 0.0, 0.0, 1.0);
		
		/*glBegin(GL_QUADS);
		 glVertex2f(blob_width/-2, blob_height/-2);
		 glVertex2f(blob_width/-2, blob_height/2);
		 glVertex2f(blob_width/2, blob_height/2);
		 glVertex2f(blob_width/2, blob_height/-2);
		 glEnd();*/
		
		glBegin(GL_TRIANGLE_FAN);
		for(double a = 0.0f; a <= 2*M_PI; a += 0.2f) {
			glVertex2d(cos(a) * blob_width, sin(a) * blob_height);
		} glEnd();
		
		glPopMatrix();
		
//.........这里部分代码省略.........
开发者ID:crunchytech,项目名称:TUIO11_CPP,代码行数:101,代码来源:TuioDemo.cpp


注:本文中的TuioCursor::getCursorID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。