fully implement KeepAlive behavior
This commit is contained in:
31
include/client/Client.h
Normal file
31
include/client/Client.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <Nazara/Core/EnttWorld.hpp>
|
||||
#include <atomic>
|
||||
#include <blitz/network/EnetClient.h>
|
||||
#include <blitz/protocol/PacketHandler.h>
|
||||
|
||||
namespace blitz {
|
||||
namespace client {
|
||||
|
||||
class Client : private NonCopyable {
|
||||
public:
|
||||
Client();
|
||||
~Client();
|
||||
|
||||
void Connect(const Nz::IpAddress& a_Ip);
|
||||
void Disconnect();
|
||||
|
||||
bool IsConnected();
|
||||
|
||||
private:
|
||||
EnttWorld m_World;
|
||||
std::unique_ptr<network::EnetClient> m_NetworkClient;
|
||||
std::vector<std::unique_ptr<protocol::PacketHandler>> m_Handlers;
|
||||
|
||||
void BindHandlers();
|
||||
void UnbindHandlers();
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
} // namespace blitz
|
||||
15
include/client/handlers/KeepAliveHandler.h
Normal file
15
include/client/handlers/KeepAliveHandler.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <blitz/protocol/PacketHandler.h>
|
||||
|
||||
namespace blitz {
|
||||
namespace client {
|
||||
|
||||
class KeepAliveHandler : public protocol::PacketHandler {
|
||||
public:
|
||||
KeepAliveHandler(network::EnetConnection& a_Connection, EnttWorld& a_World);
|
||||
~KeepAliveHandler();
|
||||
|
||||
NazaraSlot(network::EnetConnection, OnKeepAlive, m_Slot);
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
} // namespace blitz
|
||||
Reference in New Issue
Block a user