blob: 86d8c902bfebd45e96545c456167c05dc2abf918 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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}};
};
}
|