1cac3c7815
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/branches/hilnius@12870 178a84e3-b1eb-0310-8ba1-8eac791a3b58
42 lines
828 B
C++
42 lines
828 B
C++
#include "client_network_manager.hpp"
|
|
|
|
#include <stdio.h>
|
|
|
|
ClientNetworkManager::ClientNetworkManager()
|
|
{
|
|
}
|
|
|
|
ClientNetworkManager::~ClientNetworkManager()
|
|
{
|
|
}
|
|
|
|
void ClientNetworkManager::run()
|
|
{
|
|
if (enet_initialize() != 0)
|
|
{
|
|
printf("Could not initialize enet.\n");
|
|
return;
|
|
}
|
|
m_localhost = new STKHost();
|
|
m_localhost->setupClient(1, 2, 0, 0);
|
|
m_localhost->startListening();
|
|
}
|
|
|
|
void ClientNetworkManager::connect(uint32_t ip, uint16_t port)
|
|
{
|
|
STKPeer* peer = new STKPeer();
|
|
peer->connectToServer(m_localhost, ip, port, 2, 0);
|
|
|
|
m_peers.push_back(peer);
|
|
}
|
|
|
|
void ClientNetworkManager::packetReceived(char* data)
|
|
{
|
|
printf("ClientNetworkManager::packetReceived()\n");
|
|
puts(data);
|
|
}
|
|
void ClientNetworkManager::sendPacket(char* data)
|
|
{
|
|
m_peers[0]->sendPacket(data);
|
|
}
|