Client.h 697 B

123456789101112131415161718192021222324252627282930313233
  1. #ifndef CLIENT_H
  2. #define CLIENT_H
  3. #include "network/Packet.h"
  4. #include "utils/Error.h"
  5. #include "utils/Types.h"
  6. namespace Client {
  7. typedef uint16 Port;
  8. typedef void (*OnConnect)();
  9. typedef void (*OnDisconnect)();
  10. typedef void (*OnPacket)(InPacket&);
  11. Error start();
  12. void stop();
  13. Error connect(const char* server, Port port, int timeoutTicks);
  14. void disconnect(int timeoutTicks);
  15. void tick();
  16. void send(OutPacket& p, PacketSendMode mode);
  17. void setConnectHandler(OnConnect oc);
  18. void setDisconnectHandler(OnDisconnect od);
  19. void setPacketHandler(OnPacket op);
  20. void resetHandler();
  21. bool isConnecting();
  22. bool isConnected();
  23. }
  24. #endif