Vector2label_size=MeasureTextEx(GetFontDefault(),to_disp_cstr,GuiGetStyle(DEFAULT,TEXT_SIZE)+1,GuiGetStyle(DEFAULT,TEXT_SPACING)+1);// The '+1' is there to account for any rounding errors
std::cout<<"Waiting for connection..."<<std::endl;
display_text_centered("Your code is "+code+"\nWaiting for connection...");
std::stringresponse="";
std::stringresponse="";
char*temp_response=NULL;
char*temp_response=NULL;
/* Wait for the right client to connect. Since recvAll returns a char*, we need to create a temporary variable to check for NULL. */
/* Wait for the client to connect. Since recvAll returns a char*, we need to create a temporary variable to check for NULL.
TODO-Checkthattheclientactuallysends'GG'.*/
do{
do{
temp_response=server->recvAll();
temp_response=server->recvAll();
}while(temp_response==NULL);
}while(temp_response==NULL);
response=std::string(temp_response);
response=std::string(temp_response);
std::cout<<"Connection received from "<<server->get_peer_addr()<<std::endl;
server->sendAll("U2");
server->sendAll("U2");
display_text_centered("Connection received from "+server->get_peer_addr());
Timertimer=timer_init(3);
while(!timer_done(timer));// Wait for five seconds
type.mode=M_SERVER;
type.mode=M_SERVER;
type.netsock=server;
type.netsock=server;
returntype;
returntype;
}
}
GameTypecheck_client(char*code_text){
GameTypetype;
std::vector<std::string>addr_port;
std::stringconnect_code=std::string(code_text);/* The connect code is a special string, that contains the server address and port. It is given by the server. */