1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
int getStickFigures() {
//int theStickId, rint[19];
for (int i=0; i<64; i++) {
if (SDLNet_UDP_Recv(sd, p))
{
printf("UDP Packet incoming\n");
printf("\tChan: %d\n", p->channel);
printf("\tData: %s\n", (char *)p->data);
printf("\tLen: %d\n", p->len);
printf("\tMaxlen: %d\n", p->maxlen);
printf("\tStatus: %d\n", p->status);
printf("\tAddress: %d %d\n", p->address.host, p->address.port);
char *test[sizeof(strtok((char *)p->data, " "))];
test[0] = strtok((char *)p->data, " ");
if (strcmp(test[0], "stickman")==0) {
test[1] = strtok (NULL, " ");
test[2] = strtok (NULL, " ");
test[3] = strtok (NULL, " ");
//test[4] = strtok (NULL, " "); rint[4]=atoi(test[4]);
//test[5] = strtok (NULL, " "); rint[5]=atoi(test[5]);
//test[6] = strtok (NULL, " "); rint[6]=atoi(test[6]);
//test[7] = strtok (NULL, " "); rint[7]=atoi(test[7]);
//test[8] = strtok (NULL, " "); rint[8]=atoi(test[8]);
//test[9] = strtok (NULL, " "); rint[9]=atoi(test[9]);
//test[10] = strtok (NULL, " "); rint[10]=atoi(test[10]);
//test[11] = strtok (NULL, " "); rint[11]=atoi(test[11]);
//test[12] = strtok (NULL, " "); rint[12]=atoi(test[12]);
//test[13] = strtok (NULL, " "); rint[13]=atoi(test[13]);
//test[14] = strtok (NULL, " "); rint[14]=atoi(test[14]);
//test[15] = strtok (NULL, " "); rint[15]=atoi(test[15]);
//test[16] = strtok (NULL, " "); rint[16]=atoi(test[16]);
//test[17] = strtok (NULL, " "); rint[17]=atoi(test[17]);
//test[18] = strtok (NULL, " "); rint[18]=atoi(test[18]);
//test[19] = strtok (NULL, " "); rint[19]=atoi(test[19]);
//for (int i=4; i < 20; i++) {
// printf("rint[%d]=%d",i,rint[i]);
//}
//theStickId=atoi(test[1]);
stickman[atoi(test[1])].position.x=atoi(test[2]);
stickman[atoi(test[1])].position.y=atoi(test[3]);
std::cout << "Right before the input functions...\n";
//stickman[theStickId].left_arm.setPoints( rint[4],rint[5],rint[6],rint[7] );
//stickman[theStickId].right_arm.setPoints( rint[8],rint[9],rint[10],rint[11] );
//stickman[theStickId].left_leg.setPoints( rint[12],rint[13],rint[14],rint[15] );
//stickman[theStickId].right_leg.setPoints( rint[16],rint[17],rint[18],rint[19] );
std::cout << "asdfasdfasdf\n";
}
std::cout << "lastpartofif\n";
}
std::cout << "beforeendofor\n";
}
std::cout << "absoluteendoffunction\n";
}
|