working on the server's skeleton, still slow going

This commit is contained in:
Kayne Ruse
2013-06-10 17:23:26 +10:00
parent 0a48131de4
commit c21a95f3e9
7 changed files with 155 additions and 19 deletions
+43 -1
View File
@@ -1,6 +1,16 @@
#ifndef SERVERAPPLICATION_HPP_
#define SERVERAPPLICATION_HPP_
#include "defines.hpp"
#include "packet_type.hpp"
#include "config_Utility.hpp"
#include "udp_network_utility.hpp"
#include "vector2.hpp"
#include <map>
#include <chrono>
class ServerApplication {
public:
ServerApplication();
@@ -8,8 +18,40 @@ public:
void Init();
void Proc();
void Quit();
ServerApplication(ServerApplication const&) = delete;
private:
bool running = true;
struct ClientData {
int index;
int channel;
int playerIndex;
};
struct PlayerData {
int index;
int clientIndex;
Vector2 position;
Vector2 motion;
void Update(double delta) {
position += motion * delta;
}
};
//game loop
void HandleNetwork();
void UpdateWorld();
//network loop
//...
Clock::time_point lastTick = Clock::now();
std::map<int, ClientData> clients;
std::map<int, PlayerData> players;
ConfigUtility configUtil;
UDPNetworkUtility netUtil;
bool running = false;
};
#endif