]> git.localhorst.tv Git - blank.git/blob - src/client/Client.hpp
fix comment handling in TokenStreamReader
[blank.git] / src / client / Client.hpp
1 #ifndef BLANK_CLIENT_CLIENT_HPP_
2 #define BLANK_CLIENT_CLIENT_HPP_
3
4 #include "../app/Config.hpp"
5 #include "../net/Connection.hpp"
6
7 #include <string>
8 #include <SDL_net.h>
9
10
11 namespace blank {
12
13 class World;
14
15 namespace client {
16
17 class Client {
18
19 public:
20         explicit Client(const Config::Network &);
21         ~Client();
22
23         void Handle();
24
25         void Update(int dt);
26
27         Connection &GetConnection() noexcept { return conn; }
28         const Connection &GetConnection() const noexcept { return conn; }
29
30         std::uint16_t SendPing();
31         std::uint16_t SendLogin(const std::string &);
32         std::uint16_t SendPart();
33         std::uint16_t SendPlayerUpdate(
34                 const EntityState &prediction,
35                 const glm::vec3 &movement,
36                 float pitch,
37                 float yaw,
38                 std::uint8_t actions,
39                 std::uint8_t slot);
40         std::uint16_t SendChunkRequest(
41                 const glm::ivec3 &);
42         std::uint16_t SendMessage(
43                 std::uint8_t type,
44                 std::uint32_t ref,
45                 const std::string &msg);
46
47 private:
48         void HandlePacket(const UDPpacket &);
49
50 private:
51         Connection conn;
52         UDPsocket client_sock;
53         UDPpacket client_pack;
54
55 };
56
57 }
58 }
59
60 #endif