- Migrated to C++20 modules - Worker and ThreadedWorker base classes for interthread systems - Client class for server transport and converting game data models to render data (views) - Update provinces render data from Client - Renderer handles commands now
51 lines
946 B
C++
51 lines
946 B
C++
module;
|
|
|
|
#include <cstdint>
|
|
|
|
export module Client;
|
|
import worker;
|
|
import GameData;
|
|
import DataChannel;
|
|
import AssetManager;
|
|
|
|
export
|
|
{
|
|
struct ClientCommand : public ee_utils::WorkerCommand
|
|
{
|
|
enum Type : std::uint8_t
|
|
{
|
|
NONE,
|
|
|
|
SEND,
|
|
|
|
COMPLETED
|
|
};
|
|
};
|
|
|
|
class Client final : public ee_utils::ThreadedWorker<ClientCommand, ClientCommand::COMPLETED>
|
|
{
|
|
public:
|
|
Client();
|
|
~Client();
|
|
void Init();
|
|
|
|
//void Send(); -> Request(SEND)
|
|
|
|
const IDataChannel* GetConnection();
|
|
void ConnectServer();
|
|
|
|
void LoadSave(const AssetHandle save);
|
|
|
|
protected:
|
|
void Update() override;
|
|
void Release() override;
|
|
|
|
private:
|
|
NetworkChannel *networkConnection = nullptr;
|
|
AssetHandle save;
|
|
|
|
void SendCmd(ClientCommand &command);
|
|
|
|
void ViewModelSubject(ee_data::Subject subject);
|
|
};
|
|
} |