add StateMachine

This commit is contained in:
2025-08-09 11:23:17 +02:00
parent ac3e949323
commit cba790f804
23 changed files with 174 additions and 244 deletions

View File

@@ -1,29 +1,21 @@
#pragma once
#include <client/IClientSocket.h>
#include <client/IClientState.h>
#include <chrono>
#include <td/common/StateMachine.h>
namespace td {
namespace client {
class Client {
class ClientState;
class Client : public StateMachine<Client, void, float> {
private:
std::shared_ptr<IClientSocket> m_Socket;
std::shared_ptr<IClientState> m_State;
std::chrono::time_point<std::chrono::system_clock> m_LastTime;
public:
Client(const std::shared_ptr<IClientSocket>& a_Socket) : m_Socket(a_Socket), m_LastTime(std::chrono::system_clock::now()) {}
Client(const std::shared_ptr<IClientSocket>& a_Socket) : m_Socket(a_Socket) {}
void Update();
void UpdateState(const std::shared_ptr<IClientState>& a_State);
private:
void Update(float a_Delta);
friend class IClientState;
friend class ClientState;
};
} // namespace client