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


C++ TuioCursor类代码示例

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


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

示例1: touchDown

void testApp::touchDown(TuioCursor & tcur)
{

	cout << "testApp::touchDown" << endl;
	touchPoints.push_back( ofPoint(tcur.getX()*ofGetWidth(), tcur.getY()*ofGetHeight()) );
	
}
开发者ID:jvcleave,项目名称:ofxWebSimpleGuiToo-for-iPhone,代码行数:7,代码来源:testApp.cpp

示例2: TuioCursor

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

示例3: drawCursors

//draw them for debug purposes
void ofxTuioServer::drawCursors() {
	char id[3];
	// draw the cursors
	std::list<TuioCursor*> cursorList = tuioServer->getTuioCursors();
	for (std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin(); tuioCursor!=cursorList.end(); tuioCursor++) {
		TuioCursor * tcur = (*tuioCursor);
		std::list<TuioPoint> path = tcur->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.getX()*ofGetWidth(), last_point.getY()*ofGetHeight(), 0.0f);
				glVertex3f(point->getX()*ofGetWidth(), point->getY()*ofGetHeight(), 0.0f);
				last_point.update(point->getX(),point->getY());
			}
			glEnd();

			// draw the finger tip
			glColor3f(0.0, 0.75, 0.75);
			//float size = tcur->getWidth() + tcur
			ofCircle(tcur->getX()*ofGetWidth(), tcur->getY()*ofGetHeight(), 10);
		}
	}
}
开发者ID:benMcChesney,项目名称:Helios_TableTop,代码行数:28,代码来源:ofxTuioServer.cpp

示例4: mouseReleased

void SimpleSimulator::mouseReleased(float x, float y) {
	//printf("released %f %f\n",x,y);

	TuioCursor *cursor = NULL;
	float distance  = 0.01f;
	for (std::list<TuioCursor*>::iterator iter = stickyCursorList.begin(); iter!=stickyCursorList.end(); iter++) {
		TuioCursor *tcur = (*iter);
		float test = tcur->getDistance(x,y);
		if (test<distance) {
			distance = test;
			cursor = tcur;
		}
	}

	if (cursor!=NULL) {
		activeCursorList.remove(cursor);
		return;
	}

	distance = 0.01f;
	for (std::list<TuioCursor*>::iterator iter = activeCursorList.begin(); iter!=activeCursorList.end(); iter++) {
		TuioCursor *tcur = (*iter);
		float test = tcur->getDistance(x,y);
		if (test<distance) {
			distance = test;
			cursor = tcur;
		}
	}

	if (cursor!=NULL) {
		activeCursorList.remove(cursor);
		tuioServer->removeTuioCursor(cursor);
	}
}
开发者ID:footas,项目名称:TUIO11_CPP,代码行数:34,代码来源:SimpleSimulator.cpp

示例5: finishCursorInfo

void IupTuioListener::finishCursorInfo(int cursor_count, int* px, int* py, int* pstate, int w, int h, int use_client_coord, Ihandle* ih_canvas)
{
  std::list<TuioCursor*>& cursorList = this->client->getCursorList();
  std::list <TuioCursor*>::iterator iter;
  std::list <TuioCursor*>::iterator end = cursorList.end();
  int i;

  for (i = 0, iter = cursorList.begin(); i<cursor_count && iter!=end; iter++, i++) 
  {
    if (pstate[i] == 0) /* if still 0, then it was not updated, must fill it here */
    {
      TuioCursor* tcur = (*iter);

      int x = tcur->getScreenX(w);
      int y = tcur->getScreenY(h);

      if (use_client_coord)
        iupdrvScreenToClient(ih_canvas, &x, &y);

      px[i] = x;
      py[i] = y;
      pstate[i] = 'M';  /* mark as MOVE */
    }
  }
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:25,代码来源:iup_tuio.cpp

示例6: TuioCursor

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

示例7: 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

示例8: tuioCursorUpdated

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

示例9: startCursorBundle

void TuioServer::commitFrame()
{

    if (updateCursor)
    {
        startCursorBundle();
        for (std::list<TuioCursor *>::iterator tuioCursor = cursorList.begin(); tuioCursor != cursorList.end(); tuioCursor++)
        {

            // start a new packet if we exceed the packet capacity
            if ((oscPacket->Capacity() - oscPacket->Size()) < CUR_MESSAGE_SIZE)
            {
                sendCursorBundle(currentFrame);
                startCursorBundle();
            }

            TuioCursor *tcur = (*tuioCursor);
            if ((full_update) || (tcur->getTuioTime() == currentFrameTime))
                addCursorMessage(tcur);
        }
        sendCursorBundle(currentFrame);
    }
    else if ((!periodic_update) && (lastCursorUpdate < currentFrameTime.getSeconds()))
    {
        lastCursorUpdate = currentFrameTime.getSeconds();
        startCursorBundle();
        sendCursorBundle(currentFrame);
    }
    updateCursor = false;

    if (updateObject)
    {
        startObjectBundle();
        for (std::list<TuioObject *>::iterator tuioObject = objectList.begin(); tuioObject != objectList.end(); tuioObject++)
        {

            // start a new packet if we exceed the packet capacity
            if ((oscPacket->Capacity() - oscPacket->Size()) < OBJ_MESSAGE_SIZE)
            {
                sendObjectBundle(currentFrame);
                startObjectBundle();
            }

            TuioObject *tobj = (*tuioObject);
            if ((full_update) || (tobj->getTuioTime() == currentFrameTime))
                addObjectMessage(tobj);
        }
        sendObjectBundle(currentFrame);
    }
    else if ((!periodic_update) && (lastObjectUpdate < currentFrameTime.getSeconds()))
    {
        lastObjectUpdate = currentFrameTime.getSeconds();
        startObjectBundle();
        sendObjectBundle(currentFrame);
    }
    updateObject = false;
}
开发者ID:nixz,项目名称:covise,代码行数:57,代码来源:TuioServer.cpp

示例10:

std::list<TuioCursor*> TuioManager::getUntouchedCursors() {
	
	std::list<TuioCursor*> untouched;
	for (std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin(); tuioCursor!=cursorList.end(); tuioCursor++) {
		TuioCursor *tcur = (*tuioCursor);
		if (tcur->getTuioTime()!=currentFrameTime) untouched.push_back(tcur);
	}	
	return untouched;
}
开发者ID:030ii,项目名称:Multitouch-Hockey-Game,代码行数:9,代码来源:TuioManager.cpp

示例11: 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

示例12: mouseDragged

void SimpleSimulator::mouseDragged(float x, float y) {
	//printf("dragged %f %f\n",x,y);

	TuioCursor *cursor = NULL;
	float distance  = width;
	for (std::list<TuioCursor*>::iterator iter = activeCursorList.begin(); iter!=activeCursorList.end(); iter++) {
		TuioCursor *tcur = (*iter);
		float test = tcur->getDistance(x,y);
		if (test<distance) {
			distance = test;
			cursor = tcur;
		}
	}

	if (cursor==NULL) return;
	if (cursor->getTuioTime()==frameTime) return;

	std::list<TuioCursor*>::iterator joint = std::find( jointCursorList.begin(), jointCursorList.end(), cursor );
	if( joint != jointCursorList.end() ) {
		float dx = x-cursor->getX();
		float dy = y-cursor->getY();
		for (std::list<TuioCursor*>::iterator iter = jointCursorList.begin(); iter!=jointCursorList.end(); iter++) {
			TuioCursor *jointCursor = (*iter);
			 tuioServer->updateTuioCursor(jointCursor,jointCursor->getX()+dx,jointCursor->getY()+dy);
		}
	} else tuioServer->updateTuioCursor(cursor,x,y);
}
开发者ID:footas,项目名称:TUIO11_CPP,代码行数:27,代码来源:SimpleSimulator.cpp

示例13: removeTuioCursor

void TuioServer::removeUntouchedStoppedCursors() {
	
	for (std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin(); tuioCursor!=cursorList.end(); tuioCursor++) {
		TuioCursor *tcur = (*tuioCursor);
		if ((tcur->getTuioTime()!=currentFrameTime) && (!tcur->getTuioState()==TUIO_ADDED) && (!tcur->isMoving())) {
			removeTuioCursor(tcur);
			removeUntouchedStoppedCursors();
			break;
		}
	}	
}
开发者ID:Ahmedn1,项目名称:ccv-hand,代码行数:11,代码来源:TuioServer.cpp

示例14: cursorUpdateHandler

void testApp::cursorUpdateHandler(TuioCursor & tcur)
{
	/*std::cout << "cursorUpdated " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY() 
	 << " " << tcur->getMotionSpeed() << " " << tcur->getMotionAccel() << " " << std::endl;*/
	
	cout << "testApp::cursorUpdateHandler: " << " tcur.getX(): " << tcur.getX() << " tcur.getY(): " << tcur.getY() << endl;
	
	touchPoints.push_back(ofPoint(tcur.getX()*ofGetWidth(), tcur.getY()*ofGetHeight()));
	//touchPoints.push_back( ofPoint(tcur.getX(), tcur.getY()) );
	//cout << "tcur.getX(): " << tcur.getX() << " tcur.getY() : " << tcur.getY() << endl;
}
开发者ID:jvcleave,项目名称:ofxWebSimpleGuiToo-for-iPhone,代码行数:11,代码来源:testApp.cpp

示例15: while

void TuioManager::removeUntouchedStoppedCursors() {
	
	if (cursorList.size()==0) return;
	std::list<TuioCursor*>::iterator tuioCursor = cursorList.begin();
	while (tuioCursor!=cursorList.end()) {
		TuioCursor *tcur = (*tuioCursor);
		if ((tcur->getTuioTime()!=currentFrameTime) && (!tcur->isMoving())) {
			removeTuioCursor(tcur);
			tuioCursor = cursorList.begin();
		} else tuioCursor++;
	}	
}
开发者ID:030ii,项目名称:Multitouch-Hockey-Game,代码行数:12,代码来源:TuioManager.cpp


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