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


C++ TuioObject::getTuioPointer方法代码示例

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


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

示例1: if

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

	TuioPointer *match = NULL;
	float distance  = 0.01f;
	for (std::list<TuioPointer*>::iterator iter = stickyPointerList.begin(); iter!=stickyPointerList.end(); iter++) {
		TuioPointer *tptr = (*iter);
		float test = tptr->getDistance(x,y);
		if ((test < distance) && (test < 8.0f/width)) {
			distance = test;
			match = tptr;
		}
	}

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

		if (match!=NULL) {
			std::list<TuioPointer*>::iterator joint = std::find( jointPointerList.begin(), jointPointerList.end(), match );
			if( joint != jointPointerList.end() ) {
				jointPointerList.erase( joint );
			}
			stickyPointerList.remove(match);
			stickyPointerList.remove(match);
			tuioServer->removeTuioPointer(match);
		} else {
			TuioObject *tobj = tuioServer->createTuioPointer(x,y,0,0,0,0);
			stickyPointerList.push_back(tobj->getTuioPointer());
			activePointerList.push_back(tobj->getTuioPointer());
		}
	} else if ((keystate[SDLK_LCTRL]) || (keystate[SDLK_RCTRL])) {

		if (match!=NULL) {
			std::list<TuioPointer*>::iterator joint = std::find( jointPointerList.begin(), jointPointerList.end(), match );
			if( joint != jointPointerList.end() ) {
				jointPointerList.remove( match );
			} else jointPointerList.push_back(match);
		}
	} else {
		if (match==NULL) {
			TuioObject *tobj = tuioServer->createTuioPointer(x,y,0,0,0,0);
			activePointerList.push_back(tobj->getTuioPointer());
        } else {
            activePointerList.push_back(match);
        }
	}
}
开发者ID:JassiO,项目名称:TUIO20_CPP,代码行数:47,代码来源:Tuio2Simulator.cpp


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