begin client-server

This commit is contained in:
2025-08-06 20:10:56 +02:00
parent 89213e9a97
commit c813c49707
26 changed files with 264 additions and 188 deletions

View File

@@ -3,6 +3,7 @@
#include <memory>
#include <server/IServerSocket.h>
#include <server/IServerState.h>
#include <chrono>
namespace td {
namespace server {
@@ -11,19 +12,23 @@ class Server {
private:
std::shared_ptr<IServerSocket> m_Socket;
std::shared_ptr<IServerState> m_State;
std::chrono::time_point<std::chrono::system_clock> m_LastTime;
public:
Server(const std::shared_ptr<IServerSocket>& a_Socket) : m_Socket(a_Socket) {}
Server(const std::shared_ptr<IServerSocket>& a_Socket) : m_Socket(a_Socket), m_LastTime(std::chrono::system_clock::now()) {}
void Update(float a_Delta) {
m_State->Update(a_Delta);
}
void Update();
void UpdateState(const std::shared_ptr<IServerState>& a_State) {
m_State = a_State;
m_State->SetServer(this);
}
private:
void Update(float a_Delta) {
m_State->Update(a_Delta);
}
friend class IServerState;
};