2016-11-04 20:15:10 +00:00
|
|
|
|
|
|
|
#include "PhysicsClientUDP_C_API.h"
|
|
|
|
#include "PhysicsClientUDP.h"
|
|
|
|
#include "PhysicsDirect.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
//think more about naming. The b3ConnectPhysicsLoopback
|
2018-09-23 21:17:31 +00:00
|
|
|
B3_SHARED_API b3PhysicsClientHandle b3ConnectPhysicsUDP(const char* hostName, int port)
|
2016-11-04 20:15:10 +00:00
|
|
|
{
|
|
|
|
UdpNetworkedPhysicsProcessor* udp = new UdpNetworkedPhysicsProcessor(hostName, port);
|
|
|
|
|
2017-01-28 20:42:04 +00:00
|
|
|
PhysicsDirect* direct = new PhysicsDirect(udp, true);
|
2016-11-04 20:15:10 +00:00
|
|
|
|
2017-01-16 06:26:11 +00:00
|
|
|
bool connected;
|
|
|
|
connected = direct->connect();
|
2017-01-28 20:42:04 +00:00
|
|
|
if (connected)
|
|
|
|
{
|
|
|
|
printf("b3ConnectPhysicsUDP connected successfully.\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-01-29 06:14:45 +00:00
|
|
|
printf("b3ConnectPhysicsUDP connection failed.\n");
|
2017-01-28 20:42:04 +00:00
|
|
|
}
|
2016-11-04 20:15:10 +00:00
|
|
|
return (b3PhysicsClientHandle)direct;
|
|
|
|
}
|