Files
bullet3/examples/SharedMemory/PhysicsClientUDP_C_API.cpp
erwincoumans 2b3c25d5f2 add a b3Clock::usleep in PhysicsClientUDP to avoid clogging all resources
report more meaningful connection status for UDP.
2017-01-28 12:42:04 -08:00

31 lines
628 B
C++

#include "PhysicsClientUDP_C_API.h"
#include "PhysicsClientUDP.h"
#include "PhysicsDirect.h"
#include <stdio.h>
//think more about naming. The b3ConnectPhysicsLoopback
b3PhysicsClientHandle b3ConnectPhysicsUDP(const char* hostName, int port)
{
UdpNetworkedPhysicsProcessor* udp = new UdpNetworkedPhysicsProcessor(hostName, port);
PhysicsDirect* direct = new PhysicsDirect(udp, true);
bool connected;
connected = direct->connect();
if (connected)
{
printf("b3ConnectPhysicsUDP connected successfully.\n");
}
else
{
printf("b3ConnectPhysicsUDP NOT connected.\n");
}
return (b3PhysicsClientHandle)direct;
}