packet is being sent and received, bare-bones ping-pong is working

This commit is contained in:
Kayne Ruse
2013-05-20 01:02:15 +10:00
parent b587759203
commit 7866f46ed5
18 changed files with 342 additions and 63 deletions
+21 -26
View File
@@ -7,38 +7,33 @@
class Player {
public:
Player(int id);
~Player() = default;
Player() = default;
Player(int playerID, int channel, std::string handle, std::string avatar);
void Update(int delta);
void Update(int);
int SetPlayerID(int id) {return playerID = id;}
int GetPlayerID() const {return playerID;}
int SetChannel(int ch) {return channel = ch;}
int GetChannel() const {return channel;}
int GetClientID() const {
return clientID;
}
Vector2 SetPosition(Vector2 v) {return position = v;}
Vector2 ShiftPosition(Vector2 v) {return position += v;}
Vector2 GetPosition() const {return position;}
Vector2 SetMotion(Vector2 v) {return motion = v;}
Vector2 ShiftMotion(Vector2 v) {return motion += v;}
Vector2 GetMotion() const {return motion;}
Vector2 SetPosition(Vector2 v) {
return position = v;
}
Vector2 GetPosition() const {
return position;
}
Vector2 SetMotion(Vector2 v) {
return motion = v;
}
Vector2 GetMotion() const {
return motion;
}
std::string SetAvatarName(std::string s) {
return avatarName = s;
}
std::string GetAvatarName() {
return avatarName;
}
std::string SetAvatar(std::string s) {return avatar = s;}
std::string GetAvatar() const {return avatar;}
std::string SetHandle(std::string s) {return handle = s;}
std::string GetHandle() const {return handle;}
private:
const int clientID;
int playerID = -1;
int channel = -1; //for networking
Vector2 position;
Vector2 motion;
std::string avatarName;
std::string avatar;
std::string handle;
};
#endif