handmade/include/UDPpacketVBuffer.h

26 lines
426 B
C
Raw Normal View History

#pragma once
#include <SDL_net.h>
class UDPpacketVBuffer
{
int npackets;
UDPpacket** packetV;
public:
UDPpacketVBuffer (UDPpacket* src, const void* buf, const size_t size);
~UDPpacketVBuffer (void)
{
if (packetV)
{
SDLNet_FreePacketV (packetV);
packetV = NULL;
}
}
int Send (UDPsocket sock)
{
int numsent;
numsent = SDLNet_UDP_SendV (sock, packetV, npackets);
return numsent;
}
};