11#include <SDL3/SDL_stdinc.h>
13#include <SDL3_net/SDL_net.h>
14#include <entt/entt.hpp>
27 bool init(
const char* addr, Uint16 port);
36 bool send(
const void* data, uint32_t size);
48 NET_Address* serverAddr =
nullptr;
49 std::optional<registry_serialization::Loader> registryLoader;
51 std::optional<entt::entity> localPlayerEntity;
52 bool localPlayerReadyNotified =
false;
Length-prefixed message framing layer over a TCP stream socket.
Shared ECS registry type alias for the game engine.
entt::registry Registry
Shared ECS registry type alias.
Definition Registry.hpp:11
TCP stream client — sends input to the server and receives state updates.
Definition Client.hpp:19
bool init(const char *addr, Uint16 port)
Create the TCP socket and connect to the server.
Definition Client.cpp:14
std::function< void(entt::entity localEntity)> LocalPlayerReadyFn
Definition Client.hpp:21
void onLocalPlayerReady(LocalPlayerReadyFn fn)
Definition Client.hpp:40
void shutdown()
Close the socket and release the resolved address.
Definition Client.cpp:41
bool sendInputSnapshot(const InputSnapshot &snap)
Definition Client.cpp:59
bool send(const void *data, uint32_t size)
Send a raw message to the server.
Definition Client.cpp:54
bool poll(Registry ®istry)
Receive and process one pending message.
Definition Client.cpp:67
Length-prefixed framing layer over a TCP stream socket.
Definition MessageStream.hpp:19