aboutsummaryrefslogtreecommitdiff
path: root/src/client/player.hh
diff options
context:
space:
mode:
authorNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
committerNicolas James <Eele1Ephe7uZahRie@tutanota.com>2025-02-12 21:57:46 +1100
commite4483eca01b48b943cd0461e24a74ae1a3139ed4 (patch)
treeed58c3c246e3af1af337697695d780aa31f6ad9a /src/client/player.hh
parent1cc08c51eb4b0f95c30c0a98ad1fc5ad3459b2df (diff)
Update to most recent version (old initial commit)
Diffstat (limited to 'src/client/player.hh')
-rw-r--r--src/client/player.hh64
1 files changed, 0 insertions, 64 deletions
diff --git a/src/client/player.hh b/src/client/player.hh
deleted file mode 100644
index c41ba23..0000000
--- a/src/client/player.hh
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef CLIENT_PLAYER_HH_
-#define CLIENT_PLAYER_HH_
-
-#include <chrono>
-#include <optional>
-#include <string>
-#include <utility>
-
-#include "client/math.hh"
-#include "client/render/camera.hh"
-#include "client/render/model.hh"
-#include "client/render/program.hh"
-#include "shared/player.hh"
-
-namespace client {
-
-// Renderable player, similar to client::chunk. We also store the message the
-// player wants to say.
-class player : public shared::player {
-public:
- static constexpr auto MSG_SHOW_TIME = std::chrono::seconds(15);
- struct message {
- std::string text;
- std::chrono::time_point<std::chrono::steady_clock> receive_time;
- message(const std::string& message) noexcept {
- this->text = message;
- this->receive_time = std::chrono::steady_clock::now();
- }
- };
- std::optional<message> message;
-
-private:
- glm::vec3 get_world_pos(const shared::player& lp) noexcept;
-
-public:
- player(shared::player&& p) noexcept
- : shared::player(std::forward<shared::player>(p)) {}
- player(const shared::player& p) noexcept : shared::player(p) {}
-
- void update(const shared::player& p) noexcept {
- this->index = p.index; // there is no syntax for doing this in one line
- this->commands = p.commands;
- this->chunk_pos = p.chunk_pos;
- this->local_pos = p.local_pos;
- this->viewangles = p.viewangles;
- this->velocity = p.velocity;
- }
-
- void draw_playermodel(const shared::player& localplayer) noexcept;
- void draw_message(const shared::player& localplayer) noexcept;
-
- const std::optional<struct message>& get_message() const noexcept {
- return this->message;
- }
-};
-
-using players = std::vector<player>;
-static inline client::player& get_localplayer(players& players) noexcept {
- return players[0];
-}
-
-} // namespace client
-
-#endif