12345678910111213141516171819202122232425262728293031 |
- #ifndef CLIENT_H
- #define CLIENT_H
- #include <thread>
- #include "Game.h"
- class Client final {
- public:
- Client();
- ~Client();
- Client(const Client& other) = delete;
- Client(Client&& other) = delete;
- Client& operator=(Client&& other) = delete;
- Client& operator=(const Client& other) = delete;
- bool isFree() const;
- void start(int clientId);
- private:
- void loop();
- void sendString(const char* buffer) const;
- void onReceive(char* buffer);
- void closeSocket();
- int id;
- std::thread thread;
- Game game;
- };
- #endif
|