Socket côté client!

This commit is contained in:
MarcEricMartel
2023-09-25 17:17:17 -04:00
parent 3ff2634e51
commit 8bc74624c3
14 changed files with 74 additions and 313 deletions

View File

@@ -2,41 +2,26 @@
#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;
};
#include "../SQCSim-common/netprotocol.h"
class Connector {
public:
Connector();
~Connector();
int Init(sockaddr_in srv_addr);
int Connect(std::string name);
int Init();
int Connect(sockaddr_in srv_addr, std::string name);
UINT64 getId() const;
unsigned int getSeed() const;
//void SendInput();
//int Sync();
private:
SOCKET m_sock = 0;
#ifdef _WIN32
WSADATA m_wsaData;
#endif
SOCKET m_sock_udp = 0,
m_sock_tcp = 0;
std::string m_name = "";
UINT64 m_sid = 0,
m_tid = 0;