Esempio n. 1
0
void ofApp::udp_rcv() {
    type_Mocap_Info *data = (type_Mocap_Info *)malloc(sizeof(type_Mocap_Info));
    char recvData[28];
    udpConnection.Receive(recvData, 28);
    data = (type_Mocap_Info *)recvData;
    int* id = (int *)data->id;
    float* x = (float *)data->x;
    float* y = (float *)data->y;
    float* z = (float *)data->z;
    float* roll= (float *)data->roll;
    float* pitch= (float *)data->pitch;
    float* yaw= (float *)data->yaw;
    // printf("%2d\t%3.3fm\t%3.3fm\t%3.3fm\t%3.2f\t%3.2f\t%3.2f\n",*id,*x,*y,*z,*roll,*pitch,*yaw);
}
Esempio n. 2
0
		void update(){
			char udpMessage[100000];
		        udp.Receive(udpMessage,100000);
		        string message=udpMessage;
		        if(message!="") {
				vector<string> res = ofSplitString(message, ",");
				mouse = ofVec2f(ofToInt(res[0]),ofToInt(res[1]));
				if(ofTrim(res[1])=="click") {
					click(1);
				}else{
					position(mouse);
				}
			}
		}