2023-09-25 08:23:52 -04:00

47 lines
775 B
C++

#ifndef CONNECTOR_H__
#define CONNECTOR_H__
#include "define.h"
#include "vector3.h"
struct Input { // vers serveur
Timestamp timestamp;
UINT8 keys; // 0bFBLRJS__
Vector3f direction;
};
struct Output { // autres joueurs du serveur
Timestamp timestamp;
UINT64 id = 0;
Vector3f position, direction;
bool is_shooting, is_jumping;
};
struct Sync { // du serveur
Timestamp timestamp;
UINT64 sid = 0;
Vector3f position;
};
class Connector {
public:
Connector();
~Connector();
int Init(sockaddr_in srv_addr);
int Connect(std::string name);
UINT64 getId() const;
unsigned int getSeed() const;
//void SendInput();
//int Sync();
private:
SOCKET m_sock = 0;
std::string m_name = "";
UINT64 m_sid = 0,
m_tid = 0;
unsigned int m_seed = 12345;
};
#endif