| 1 |
#include "rakclient.h" |
|---|
| 2 |
|
|---|
| 3 |
// Moved out of main - needs global scope |
|---|
| 4 |
|
|---|
| 5 |
extern "C" { |
|---|
| 6 |
|
|---|
| 7 |
RakClientInterface *rakClientInterface; |
|---|
| 8 |
|
|---|
| 9 |
// external bitstream server can send |
|---|
| 10 |
extern RakNet::BitStream *dataStream; |
|---|
| 11 |
|
|---|
| 12 |
void rakClientInterface_DeallocatePacket(Packet *p) |
|---|
| 13 |
{ |
|---|
| 14 |
rakClientInterface->DeallocatePacket(p); |
|---|
| 15 |
} |
|---|
| 16 |
|
|---|
| 17 |
Packet* rakClientInterface_ReceivePacket() |
|---|
| 18 |
{ |
|---|
| 19 |
return rakClientInterface->Receive(); |
|---|
| 20 |
} |
|---|
| 21 |
|
|---|
| 22 |
bool isRakClientInterface() |
|---|
| 23 |
{ |
|---|
| 24 |
if (rakClientInterface) |
|---|
| 25 |
return true; |
|---|
| 26 |
|
|---|
| 27 |
return false; |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
void rakClientInterface_Initialize() |
|---|
| 31 |
{ |
|---|
| 32 |
rakClientInterface=RakNetworkFactory::GetRakClientInterface(); |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
bool rakClientInterface_Connect(char *host, unsigned short serverPort, unsigned short clientPort, unsigned long connectionValidationInteger, int threadSleepTimer) |
|---|
| 37 |
{ |
|---|
| 38 |
return rakClientInterface->Connect(host, serverPort, clientPort, connectionValidationInteger, threadSleepTimer); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
bool rakClientInterface_RPC(char *uniqueID, char *data, unsigned long bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, bool shiftTimestamp) |
|---|
| 42 |
{ |
|---|
| 43 |
return rakClientInterface->RPC(uniqueID, data, bitLength, priority, reliability, orderingChannel, shiftTimestamp); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
void RakClientInterface_Destroy() |
|---|
| 48 |
{ |
|---|
| 49 |
RakNetworkFactory::DestroyRakClientInterface(rakClientInterface); |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
void rakClientInterface_REG_AS_RPC(char* uniqueID, void ( *functionName ) ( char *input, int numberOfBitsOfData, PlayerID sender )) |
|---|
| 53 |
{ |
|---|
| 54 |
rakClientInterface->RegisterAsRemoteProcedureCall(uniqueID, functionName); |
|---|
| 55 |
} |
|---|
| 56 |
|
|---|
| 57 |
void rakClientInterface_Disconnect (unsigned blockDuration) |
|---|
| 58 |
{ |
|---|
| 59 |
rakClientInterface->Disconnect(blockDuration); |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
bool rakClientInterface_SendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel) |
|---|
| 63 |
{ |
|---|
| 64 |
return rakClientInterface->Send(dataStream, priority, reliability, orderingChannel); |
|---|
| 65 |
} |
|---|
| 66 |
|
|---|
| 67 |
PlayerID rakClientInterface_GetPlayerID() |
|---|
| 68 |
{ |
|---|
| 69 |
return rakClientInterface->GetPlayerID(); |
|---|
| 70 |
} |
|---|
| 71 |
|
|---|
| 72 |
|
|---|
| 73 |
} |
|---|