• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TuioCursor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: initCursorInfo

void IupTuioListener::initCursorInfo(int cursor_count, int* pid, int* pstate)
{
  std::list<TuioCursor*>& cursorList = this->client->getCursorList();
  std::list <TuioCursor*>::iterator iter;
  int i;

  for (i = 0, iter = cursorList.begin() ; i<cursor_count; iter++, i++) 
  {
    TuioCursor* tcur = (*iter);
    pid[i] = (int)tcur->getSessionID();
    pstate[i] = 0;  /* mark to be updated later */
  }
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:13,代码来源:iup_tuio.cpp


示例17: stopUntouchedMovingCursors

void moTUIOSystemData::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)
				std::cout << "set cur " << tcur->getCursorID() << " (" <<  tcur->getSessionID() << ") " << tcur->getX() << " " << tcur->getY()
				<< " " << tcur->getXSpeed() << " " << tcur->getYSpeed()<< " " << tcur->getMotionAccel() << " " << std::endl;
				*/
		}
	}
}
开发者ID:inaes-tic,项目名称:tv-moldeo,代码行数:16,代码来源:moFilterManager.cpp


示例18: GetMainCursor

int IupTuioListener::GetMainCursor()
{
  std::list<TuioCursor*>& cursorList = this->client->getCursorList();
  std::list <TuioCursor*>::iterator iter;
  std::list <TuioCursor*>::iterator end = cursorList.end();
  int min_id = -1;

  for (iter = cursorList.begin(); iter!=end; iter++) 
  {
    TuioCursor* tcur = (*iter);
    int id = (int)tcur->getSessionID();
    if (min_id == -1 || id < min_id)
      min_id = id;
  }

  return min_id;
}
开发者ID:DavidPhillipOster,项目名称:IupCocoa,代码行数:17,代码来源:iup_tuio.cpp


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


示例20: SDL_GetKeyState

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

	TuioCursor *match = 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) && (test < 8.0f/width)) {
			distance = test;
			match = tcur;
		}
	}

	Uint8 *keystate = SDL_GetKeyState(NULL);
	if ((keystate[SDLK_LSHIFT]) || (keystate[SDLK_RSHIFT]))  {

		if (match!=NULL) {
			std::list<TuioCursor*>::iterator joint = std::find( jointCursorList.begin(), jointCursorList.end(), match );
			if( joint != jointCursorList.end() ) {
				jointCursorList.erase( joint );
			}
			stickyCursorList.remove(match);
			activeCursorList.remove(match);
			tuioServer->removeTuioCursor(match);
		} else {
			TuioCursor *cursor = tuioServer->addTuioCursor(x,y);
			stickyCursorList.push_back(cursor);
			activeCursorList.push_back(cursor);
		}
	} else if ((keystate[SDLK_LCTRL]) || (keystate[SDLK_RCTRL])) {

		if (match!=NULL) {
			std::list<TuioCursor*>::iterator joint = std::find( jointCursorList.begin(), jointCursorList.end(), match );
			if( joint != jointCursorList.end() ) {
				jointCursorList.remove( match );
			} else jointCursorList.push_back(match);
		}
	} else {
		if (match==NULL) {
			TuioCursor *cursor = tuioServer->addTuioCursor(x,y);
			activeCursorList.push_back(cursor);
		} else activeCursorList.push_back(match);
	}
}
开发者ID:footas,项目名称:TUIO11_CPP,代码行数:45,代码来源:SimpleSimulator.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ TuioObject类代码示例发布时间:2022-05-31
下一篇:
C++ Tstring类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap