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


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

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


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

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

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

示例3: draw

//--------------------------------------------------------------
void TuioKinect::draw()
{
	float height = (float)ofGetHeight();
	float width = (float)ofGetWidth() ; 
	
	ofSetColor(0,0,0,200) ; 
	
	//Additive blend mode
	glBlendFunc(GL_SRC_COLOR, GL_ONE);
	
	ofSetColor(255, 255, 255) ; 
	ofEnableSmoothing();
	
	for(int i=0; i< customParticles.size(); i++) 
	{
		customParticles[i].draw(0);
	}
	
	box2d.draw();
	box2d.drawGround() ;

	ofSetColor(255, 255, 255);
	std::list<TuioCursor*> alive_cursor_list = tuioServer->getTuioCursors();
	std::list<TuioCursor*>::iterator alive_cursor;
	
	for (alive_cursor=alive_cursor_list.begin(); alive_cursor!= alive_cursor_list.end(); alive_cursor++) 
	{
		TuioCursor *ac = (*alive_cursor);
		
		float absXSpeed = ac->getXSpeed() ;
		float absYSpeed = ac->getYSpeed() ;
		float xpos = ac->getX() * (float)ofGetWidth() ; 
		float ypos = ac->getY() * (float)ofGetHeight() ; 
		
		absXSpeed = ( absXSpeed < 0 ) ? absXSpeed * -1 : absXSpeed ; 
		absYSpeed = ( absYSpeed < 0 ) ? absYSpeed * -1 : absYSpeed ; 
			
		if ( absXSpeed > .30 || absYSpeed > .30 ) 
		{	
			int _size  = customParticles.size() ;
			if ( _size < 20 ) 
			{
				CustomParticle p;
				
				if ( _size % 2 == 0 ) 
				{
					p.changeIsFire(true);
				}
				else {
					p.changeIsFire(false) ; 
				}

				float r = ofRandom(.25f, 1.0f); //normalized diff
				p.setPhysics(4.0 * r, .2 * r, .45 * r );
				p.setup(box2d.getWorld(), xpos, ypos, (r*30) );
				p.setVelocity( ac->getXSpeed()*10 , ac->getYSpeed()*10 ) ; 
				customParticles.push_back(p);
			}
		}
		
		//Draw that path!
		drawTuioPath( ac->getPath() ) ; 
	}
	
	//Debug Text
	ofSetColor(255, 255, 255);
	char reportStr[1024];
	sprintf(reportStr, "set near threshold %i (press: + -)\nset far threshold %i (press: < >)\nnum blobs found %i, fps: %i", nearThreshold, farThreshold, (int)contourFinder.blobs.size(), (int)ofGetFrameRate());
	ofDrawBitmapString(reportStr, 20, 650);
	ofEnableAlphaBlending() ; 

	ofSetColor ( 10 , 10 , 10 ); 
	ofFill() ; 
	ofSetLineWidth( 2 ) ;
	ofRect(0, 0, 40, 40 ) ; 
		
	ofSetColor(255, 255, 255 ) ; 
	ofFill() ;

	grayImage.draw(5, 5, 192, 144 );
	contourFinder.draw(5, 5, 192, 144 );
	ofFill() ;
	ofDisableAlphaBlending() ; 
}
开发者ID:6301158,项目名称:KinectHacks,代码行数:85,代码来源:TuioKinect.cpp

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