Smoother movement over network. Some refactoring on client side. Now uses EKeyUp to determine if a key is pressed.
This commit is contained in:
@@ -10,10 +10,12 @@
|
||||
#include "Network/MessageType.h"
|
||||
#include "Network/NetworkDefinitions.h"
|
||||
#include "Network/PlayerDefinition.h"
|
||||
#include "Network/SnapshotDefinitions.h"
|
||||
#include "Network/WinLeakCheck.h"
|
||||
#include "Core/World.h"
|
||||
#include "Core/EventBroker.h"
|
||||
#include "Core/EKeyDown.h"
|
||||
#include "Core/EKeyUp.h"
|
||||
|
||||
|
||||
class Client
|
||||
@@ -25,8 +27,8 @@ public:
|
||||
void Close();
|
||||
|
||||
private:
|
||||
// Threaded
|
||||
void ReadFromServer();
|
||||
void SendToServer();
|
||||
|
||||
int Receive(char* data, size_t length);
|
||||
int CreateMessage(MessageType type, std::string message, char* data);
|
||||
@@ -52,6 +54,7 @@ private:
|
||||
glm::vec2 m_PlayerPositions[MAXCONNECTIONS];
|
||||
//std::string m_PlayerNames[MAXCONNECTIONS];
|
||||
PlayerDefinition m_PlayerDefinitions[MAXCONNECTIONS];
|
||||
SnapshotDefinitions m_NextSnapshot;
|
||||
std::clock_t m_StartPingTime;
|
||||
double m_DurationOfPingTime;
|
||||
std::string m_PlayerName;
|
||||
@@ -60,7 +63,9 @@ private:
|
||||
// Events
|
||||
EventBroker* m_EventBroker;
|
||||
EventRelay<Client, Events::KeyDown> m_EKeyDown;
|
||||
bool OnKeyDown(const Events::KeyDown &e);
|
||||
bool OnKeyDown(const Events::KeyDown &e);
|
||||
EventRelay<Client, Events::KeyUp> m_EKeyUp;
|
||||
bool OnKeyUp(const Events::KeyUp &e);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user