Refactoring. Client and server has Update Loop that runs before any game logic each frame.

This commit is contained in:
stiffly
2015-12-15 14:53:56 +01:00
parent 0a8a9e5099
commit 478c692315
8 changed files with 88 additions and 57 deletions
+4
View File
@@ -25,6 +25,7 @@ public:
Client();
~Client();
void Start(World* world, EventBroker* eventBroker);
void Update();
void Close();
private:
void ReadFromServer();
@@ -56,6 +57,9 @@ private:
unsigned int m_PreviousPacketID = 0;
unsigned int m_SendPacketID = 0;
// Game Logic
std::vector<unsigned int> m_PlayersToCreate;
World* m_World;
int m_PlayerID = -1;
glm::vec2 m_PlayerPositions[MAXCONNECTIONS];
+3
View File
@@ -21,6 +21,7 @@ public:
Server();
~Server();
void Start(World* m_world, EventBroker *eventBroker);
void Update();
void Close();
private:
@@ -35,6 +36,8 @@ private:
// Game logic
World* m_World;
EventBroker* m_EventBroker;
// size = players to create, stores playerID
std::vector<unsigned int> m_PlayersToCreate;
// Packet loss logic
unsigned int m_PacketID;
unsigned int m_PreviousPacketID;