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


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

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


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

示例1: stopUntouchedMovingCursors

void TuioManager::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:030ii,项目名称:Multitouch-Hockey-Game,代码行数:14,代码来源:TuioManager.cpp

示例2: oscMessageReceived

void TuioClient::oscMessageReceived (const OSCMessage& message)  {
    
    
    
    if( message.getAddressPattern() == "/tuio/2Dcur" ) {
        String cmd;
        cmd = message[0].getString();
        
        if (cmd == "set") {
            
            int32 s_id;
            float xpos, ypos, xspeed, yspeed, maccel;
            s_id=message[1].getInt32();
            xpos=message[2].getFloat32();
            ypos=message[3].getFloat32();
            xspeed =message[4].getFloat32();
            yspeed=message[5].getFloat32();
            maccel=message[6].getFloat32();
            
            
            std::list<TuioCursor*>::iterator tcur;
            for (tcur=cursorList.begin(); tcur!= cursorList.end(); tcur++)
                if((*tcur)->getSessionID()==(long)s_id) break;
            
            if (tcur==cursorList.end()) {
                
                TuioCursor *addCursor = new TuioCursor((long)s_id,-1,xpos,ypos);
                frameCursors.push_back(addCursor);
                
            } else if ( ((*tcur)->getX()!=xpos) || ((*tcur)->getY()!=ypos) || ((*tcur)->getXSpeed()!=xspeed) || ((*tcur)->getYSpeed()!=yspeed) || ((*tcur)->getMotionAccel()!=maccel) ) {
                
                int id = (*tcur)->getCursorID();
                TuioCursor *updateCursor = new TuioCursor((long)s_id,id,xpos,ypos);
                updateCursor->update(xpos,ypos,xspeed,yspeed,maccel);
                frameCursors.push_back(updateCursor);
                
                
                
                
            }
            
            
            
            
        } else if (cmd=="alive") {
            
            aliveCursorList.clear();
            for(int i = 1; i < message.size() ; i++) {
                aliveCursorList.push_back(message[i].getInt32());
            }
            

        } else if( cmd== "fseq"  ){
            
            int32 fseq;
            fseq = message[1].getInt32();
            bool lateFrame = false;
            if (fseq>0) {
                if (fseq>currentFrame) currentTime = TuioTime::getSessionTime();
                if ((fseq>=currentFrame) || ((currentFrame-fseq)>100)) currentFrame = fseq;
                else lateFrame = true;
            }  else if ((TuioTime::getSessionTime().getTotalMilliseconds()-currentTime.getTotalMilliseconds())>100) {
                currentTime = TuioTime::getSessionTime();
            }
			
            if (!lateFrame) {
                
                //                lockCursorList();
                // find the removed cursors first
                for (std::list<TuioCursor*>::iterator tcur=cursorList.begin(); tcur != cursorList.end(); tcur++) {
                    std::list<long>::iterator iter = find(aliveCursorList.begin(), aliveCursorList.end(), (*tcur)->getSessionID());
                    
                    if (iter == aliveCursorList.end()) {
                        (*tcur)->remove(currentTime);
                        frameCursors.push_back(*tcur);
                    }
                }
                //                unlockCursorList();
                
                for (std::list<TuioCursor*>::iterator iter=frameCursors.begin(); iter != frameCursors.end(); iter++) {
                    TuioCursor *tcur = (*iter);
                    
                    int c_id = -1;
                    TuioCursor *frameCursor = NULL;
                    switch (tcur->getTuioState()) {
                        case TUIO_REMOVED:
                            frameCursor = tcur;
                            frameCursor->remove(currentTime);
                            
                            for (std::list<TuioListener*>::iterator listener=listenerList.begin(); listener != listenerList.end(); listener++)
                                (*listener)->removeTuioCursor(frameCursor);
                            
                            //                            lockCursorList();
                            for (std::list<TuioCursor*>::iterator delcur=cursorList.begin(); delcur!=cursorList.end(); delcur++) {
                                if((*delcur)->getSessionID()==frameCursor->getSessionID()) {
                                    cursorList.erase(delcur);
                                    break;
                                }
                            }
                            
//.........这里部分代码省略.........
开发者ID:MartinHN,项目名称:PdPulpito,代码行数:101,代码来源:TuioClient.cpp


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