Herramientas de usuario

Herramientas del sitio


wiki2:cpp:libraries:openframeworks

¡Esta es una revisión vieja del documento!


OpenFrameworks

Installation and use

Installation

Use in Eclipse

  • Follow the tutorial until have OpenFrameworks and Addons in your projects.

You only need to add OpenFrameworks and Addons projects as references in your new project.

Notes

  • To add an addon after having created the project you just need to include its name in the addons.make file.

Addons

ofxNetwork

UDP

Crear un listener de UDP:

ofxUDPManager udpConnection;
 
udpConnection.Create();
udpConnection.Bind(5001);
udpConnection.SetNonBlocking(true);
 
char udpMessage[10000];
udpConnection.Receive(udpMessage,10000);
std::string message=udpMessage;

ofxJSOn

ofxJSONElement result;
std::string url = "http://127.0.0.1:5000/sketch/1";
bool parsingSuccessful = result.open(url);
 
if (parsingSuccessful)
{
	//ofLogNotice("ofApp::setup") << "Ok!" << endl << result.getRawString() << endl;
	Json::Int64 value = result["paths"][0]["start_t"].asInt64();
	ofLogNotice("ofApp::setup") << value << endl;
	Json::ArrayIndex npoints = result["paths"][0]["points"].size();
	ofLogNotice("ofApp::setup") << npoints << endl;
 
	for (unsinged int i=0; i<result["paths"][0]["points"].size(); i++)
		ofxJSONElement point = result["paths"][0]["points"][i];
 
	ofxJSONElement result2;
	ofLogNotice("ofApp::setup") << result2.parse("{\"hola\": \"adios\"}");
	ofLogNotice("ofApp::setup") << result2["hola"].asString();
}
else
{
	ofLogNotice("ofApp::setup")  << "Failed to parse JSON" << endl;
}
wiki2/cpp/libraries/openframeworks.1438509763.txt.gz · Última modificación: 2020/05/09 09:25 (editor externo)