summary refs log tree commit diff
path: root/src/Entities/Player.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Player.hpp')
-rw-r--r--src/Entities/Player.hpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/Entities/Player.hpp b/src/Entities/Player.hpp
new file mode 100644
index 0000000..86d8c90
--- /dev/null
+++ b/src/Entities/Player.hpp
@@ -0,0 +1,40 @@
+#pragma once
+
+#include "../Time.hpp"
+#include "../Transform.hpp"
+#include "../GFX/Camera.hpp"
+#include "../World/World.hpp"
+#include "../GFX/Window.hpp"
+#include "../Math/AABB.hpp"
+#include "../Math/Rotation.hpp"
+#include "../World/Position.hpp"
+
+namespace MC::Entities {
+
+class Player {
+public:
+    explicit Player(Position::World position) : m_transform(position) {}
+
+    void update(const Time& time, GFX::Window& window, GFX::Camera& camera, World::World& world);
+
+    void move(Position::WorldOffset by);
+    void move_to(Position::World to);
+
+    void rotate(Rotation by);
+    void rotate_to(Rotation to);
+
+    AABB bounds() const;
+private:
+    void update_camera_position(GFX::Camera& camera);
+
+    static Bool collides_with_terrain(Position::World new_position, World::World& world);
+
+    // Creates a bounding box where `position` is at the center of the bottom face.
+    static AABB bounding_box_for_position(Position::World position);
+
+    Transform m_transform;
+
+    static inline AABB s_bounds{{0.35, 1.8, 0.35}};
+};
+
+}