Client.h 561 B

12345678910111213141516171819202122232425262728293031
  1. #ifndef CLIENT_H
  2. #define CLIENT_H
  3. #include <thread>
  4. #include "Game.h"
  5. class Client final {
  6. public:
  7. Client();
  8. ~Client();
  9. Client(const Client& other) = delete;
  10. Client(Client&& other) = delete;
  11. Client& operator=(Client&& other) = delete;
  12. Client& operator=(const Client& other) = delete;
  13. bool isFree() const;
  14. void start(int clientId);
  15. private:
  16. void loop();
  17. void sendString(const char* buffer) const;
  18. void onReceive(char* buffer);
  19. void closeSocket();
  20. int id;
  21. std::thread thread;
  22. Game game;
  23. };
  24. #endif