aboutsummaryrefslogtreecommitdiff
path: root/src/client/state/state.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/state/state.hh')
-rw-r--r--src/client/state/state.hh41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/client/state/state.hh b/src/client/state/state.hh
new file mode 100644
index 0000000..cfbb440
--- /dev/null
+++ b/src/client/state/state.hh
@@ -0,0 +1,41 @@
+#ifndef CLIENT_STATE_STATE_HH_
+#define CLIENT_STATE_STATE_HH_
+
+#include <optional>
+
+#include "shared/entity/entity.hh"
+#include "shared/net/connection.hh"
+#include "shared/shared.hh"
+
+namespace client {
+namespace state {
+
+inline std::string_view address;
+inline std::string_view port;
+inline std::uint64_t seed;
+inline std::size_t player_count;
+inline std::size_t requested_chunk_count;
+inline std::size_t networked_chunk_count;
+inline std::int32_t draw_distance;
+inline std::int32_t chunks_per_frame;
+inline std::uint32_t tickrate;
+
+inline shared::tick_t tick;
+inline float delta_ticks; // num ticks since the last tick, [0, inf)
+shared::time_duration_t get_time_per_tick() noexcept;
+
+// Speed of the client's move ticks should be 1.0f but if we're too slow (or the
+// server lags and we're too fast) this value should move to speed up the client
+// somewhat gracefully.
+inline float time_factor = 1.0f;
+
+inline shared::net::connection* connection = nullptr;
+
+// non-opt after init
+inline std::optional<shared::entity::index_t> localplayer_index;
+bool has_initialised() noexcept;
+
+} // namespace state
+} // namespace client
+
+#endif