X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fnet%2FServer.hpp;fp=src%2Fnet%2FServer.hpp;h=b6a72a91b8b30e327f410e3eed793d11691320dd;hb=9ebe2c320fd9f94266ab93fa2f9d9908a0a284d3;hp=0000000000000000000000000000000000000000;hpb=f27b8bb27fa87487bb5d29a1456e610255287b04;p=blank.git diff --git a/src/net/Server.hpp b/src/net/Server.hpp new file mode 100644 index 0000000..b6a72a9 --- /dev/null +++ b/src/net/Server.hpp @@ -0,0 +1,47 @@ +#ifndef BLANK_NET_SERVER_HPP +#define BLANK_NET_SERVER_HPP + +#include +#include + + +namespace blank { + +class Connection; +class World; + +class Server { + +public: + struct Config { + Uint16 port = 12354; + }; + +public: + Server(const Config &, World &); + ~Server(); + + void Handle(); + + void Update(int dt); + +private: + void HandlePacket(const UDPpacket &); + + Connection &GetClient(const IPaddress &); + + void OnConnect(Connection &); + void OnDisconnect(Connection &); + +private: + UDPsocket serv_sock; + UDPpacket serv_pack; + std::list clients; + + World &world; + +}; + +} + +#endif