Début protocole
This commit is contained in:
46
SQCSim2021/connector.h
Normal file
46
SQCSim2021/connector.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#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
|
Reference in New Issue
Block a user