| 1 |
module raknet.client; |
|---|
| 2 |
|
|---|
| 3 |
import raknet.raknet; |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
bool isClient() |
|---|
| 7 |
{ |
|---|
| 8 |
return isRakClientInterface(); |
|---|
| 9 |
} |
|---|
| 10 |
|
|---|
| 11 |
void initialize() |
|---|
| 12 |
{ |
|---|
| 13 |
rakClientInterface_Initialize(); |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
bool connect(char *host, ushort serverPort, ushort clientPort, uint connectionValidationInteger, int threadSleepTimer) |
|---|
| 17 |
{ |
|---|
| 18 |
return rakClientInterface_Connect(host, serverPort, clientPort, connectionValidationInteger, threadSleepTimer); |
|---|
| 19 |
} |
|---|
| 20 |
|
|---|
| 21 |
bool RPC(char *uniqueID, char *data, uint bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, bool shiftTimestamp) |
|---|
| 22 |
{ |
|---|
| 23 |
return rakClientInterface_RPC(uniqueID, data, bitLength, priority, reliability, orderingChannel, shiftTimestamp); |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
void deallocatePacket(Packet *p) |
|---|
| 27 |
{ |
|---|
| 28 |
rakClientInterface_DeallocatePacket(p); |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
void destroy() |
|---|
| 32 |
{ |
|---|
| 33 |
RakClientInterface_Destroy(); |
|---|
| 34 |
} |
|---|
| 35 |
|
|---|
| 36 |
Packet* receivePacket() |
|---|
| 37 |
{ |
|---|
| 38 |
return rakClientInterface_ReceivePacket(); |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
void disconnect (uint blockDuration) |
|---|
| 42 |
{ |
|---|
| 43 |
rakClientInterface_Disconnect(blockDuration); |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
void sendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel) |
|---|
| 47 |
{ |
|---|
| 48 |
rakClientInterface_SendBitstream(priority, reliability, orderingChannel); |
|---|
| 49 |
} |
|---|
| 50 |
|
|---|
| 51 |
PlayerID playerID() |
|---|
| 52 |
{ |
|---|
| 53 |
return rakClientInterface_GetPlayerID(); |
|---|
| 54 |
} |
|---|
| 55 |
|
|---|
| 56 |
// will crash if not alias'd |
|---|
| 57 |
alias rakClientInterface_REG_AS_RPC REG_AS_RPC; |
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
extern(C): |
|---|
| 61 |
|
|---|
| 62 |
// ugly names |
|---|
| 63 |
private { |
|---|
| 64 |
bool isRakClientInterface(); |
|---|
| 65 |
|
|---|
| 66 |
void rakClientInterface_Initialize(); |
|---|
| 67 |
|
|---|
| 68 |
bool rakClientInterface_Connect(char *host, ushort serverPort, ushort clientPort, uint connectionValidationInteger, int threadSleepTimer); |
|---|
| 69 |
|
|---|
| 70 |
bool rakClientInterface_RPC(char *uniqueID, char *data, uint bitLength, PacketPriority priority, PacketReliability reliability, char orderingChannel, bool shiftTimestamp); |
|---|
| 71 |
|
|---|
| 72 |
void rakClientInterface_DeallocatePacket(Packet *); |
|---|
| 73 |
|
|---|
| 74 |
void RakClientInterface_Destroy(); |
|---|
| 75 |
|
|---|
| 76 |
Packet* rakClientInterface_ReceivePacket(); |
|---|
| 77 |
|
|---|
| 78 |
void rakClientInterface_REG_AS_RPC(char* uniqueID, void ( *functionName ) ( char *input, int numberOfBitsOfData, PlayerID sender )); |
|---|
| 79 |
|
|---|
| 80 |
void rakClientInterface_Disconnect (uint blockDuration); |
|---|
| 81 |
|
|---|
| 82 |
void rakClientInterface_SendBitstream(PacketPriority priority, PacketReliability reliability, char orderingChannel); |
|---|
| 83 |
|
|---|
| 84 |
PlayerID rakClientInterface_GetPlayerID(); |
|---|
| 85 |
} |
|---|