Beispiel #1
0
bool App::processOscMessage(const osc::ReceivedMessage& message,
								  const osc::MessageSource& source)
{
	LOG_DEBUG << "received " << message.path() << " " << message.types() << std::endl;
    
    if(message.path() == getOscRootAddress() + "/scene")
    {
        if(message.types() == "s")
        {
            string scene = message.asString(0);
            sceneManager.gotoScene(scene);
            return true;
        }
        else if(message.types() == "i")
        {
            int index = message.asInt32(0);
            sceneManager.gotoScene(index);
            return true;
        }
    }
    
    else if(message.path() == getOscRootAddress() + "/scene/prev")
    {
    	sceneManager.prevScene();
    	return true;
    }
    
    else if(message.path() == getOscRootAddress() + "/scene/next")
    {
    	sceneManager.nextScene();
    	return true;
    }

    else if(message.path() == getOscRootAddress() + "/quit")
    {
        exitMainLoop();
        return true;
    }

    return false;
}
Beispiel #2
0
bool Sprite::processOscMessage(const osc::ReceivedMessage& message,
                               const osc::MessageSource& source)
{
	// call the base class
	if(DrawableObject::processOscMessage(message, source))
	{
		return true;
	}

	if(message.path() == getOscRootAddress() + "/position" &&
	   message.types() == "ii")
	{
		//osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
		pos.x = message.asInt32(0);
		pos.y = message.asInt32(1);
		return true;
	}
	else if(message.path() == getOscRootAddress() + "/position/x" &&
	        message.types() == "i")
	{
		//osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
		pos.x = message.asInt32(0);
		return true;
	}
	else if(message.path() == getOscRootAddress() + "/position/y" &&
	        message.types() == "i")
	{
	   // osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
		pos.y = message.asInt32(0);
		return true;
	}

	else if(message.path() == getOscRootAddress() + "/center" &&
	        message.types() == "i")
	{
		//osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
		setDrawFromCenter((bool) message.asInt32(0));
		return true;
	}

	else if(message.path() == getOscRootAddress() + "/animate" &&
	        message.types() == "i")
	{
		//osc::ReceivedMessage::const_iterator arg = m.ArgumentsBegin();
		bAnimate = (bool) message.asInt32(0);
		return true;
	}
	
	else if(message.path() == getOscRootAddress() + "/overlay" &&
	        message.types() == "i")
	{
		bDrawAllLayers = (bool) message.asInt32(0);
		return true;
	}

	return false;
}