X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FClient.hpp;fp=src%2Fnet%2FClient.hpp;h=63c3fdd5e9f7d1aa7ae020fe4d22ef19b0031ce4;hb=9ebe2c320fd9f94266ab93fa2f9d9908a0a284d3;hp=0000000000000000000000000000000000000000;hpb=f27b8bb27fa87487bb5d29a1456e610255287b04;p=blank.git diff --git a/src/net/Client.hpp b/src/net/Client.hpp new file mode 100644 index 0000000..63c3fdd --- /dev/null +++ b/src/net/Client.hpp @@ -0,0 +1,45 @@ +#ifndef BLANK_NET_CLIENT_HPP_ +#define BLANK_NET_CLIENT_HPP_ + +#include "Connection.hpp" + +#include +#include + + +namespace blank { + +class World; + +class Client { + +public: + struct Config { + std::string host = "localhost"; + Uint16 port = 12354; + }; + +public: + Client(const Config &, World &); + ~Client(); + + void Handle(); + + void Update(int dt); + + bool TimedOut() { return conn.TimedOut(); } + +private: + void HandlePacket(const UDPpacket &); + +private: + World &world; + Connection conn; + UDPsocket client_sock; + UDPpacket client_pack; + +}; + +} + +#endif