Ejemplo n.º 1
0
void ofApp::update()
{
    handleStateChanges();
    motionExtractor->update();


	if (sendVideo) {
		colorPixels.setFromPixels(motionExtractor->getColorPixels()); //Get Color Stream
		colorPixels.resize(480, 270); //Resize color stream to improve speed
		colorPixels.setImageType(OF_IMAGE_GRAYSCALE);
		server.send(colorPixels.getPixels()); //send resized color stream
	}


    if(currState == STATE_CAPTURING){
        handsInfo = motionExtractor->getHandsInfo();
        sendHandInfo();
    }

	//OSC
	while (oscReceiver.hasWaitingMessages()) {
		ofxOscMessage m;
		oscReceiver.getNextMessage(&m);
		if (m.getAddress() == "/receiver/reset")
			resetKinect();
		else if (m.getAddress() == "/receiver/ipvideo")
			sendVideo = m.getArgAsBool(0);
		else if (m.getAddress() == "/receiver/positionedThreshold")
			motionExtractor->setPositionedThreshold(m.getArgAsFloat(0));
		else if (m.getAddress() == "/receiver/meanSize")
			motionExtractor->setMeanSize(m.getArgAsInt32(0));
	}
}
Ejemplo n.º 2
0
BOOL Game::tick(DWORD currentTime)
{
    BOOL returnValue = FALSE;
    itsLastTickTime = currentTime;
	
	handleStateChanges(currentTime);

    if ( processInput(currentTime) )
    {
		// If we are here, we are assuming that any data structure that was
		// present during processInput() is in the same state (i.e. valid, NULL, etc)
		// as it was before that call.  In other words, we haven't changed the world, object
		// list, or anything else since then.
        if ( update() )
        {
            returnValue = draw();
        }
        else
        {
            Logger::error("%s: Error from update!",__FILE__);
        }
    }
    else
    {
        Logger::error("%s: Error from processInput!",__FILE__);
    }
    return returnValue;
}