refactor: add Window interface

This commit is contained in:
MihailRis
2025-04-02 14:59:53 +03:00
parent cd5c6a889c
commit 9694a59649
31 changed files with 859 additions and 923 deletions
+6 -4
View File
@@ -60,7 +60,7 @@ void CameraControl::refreshRotation() {
);
}
void CameraControl::updateMouse(PlayerInput& input) {
void CameraControl::updateMouse(PlayerInput& input, int windowHeight) {
glm::vec3 rotation = player.getRotation();
float sensitivity =
@@ -68,7 +68,7 @@ void CameraControl::updateMouse(PlayerInput& input) {
: settings.sensitivity.get());
auto d = glm::degrees(
input.delta / static_cast<float>(Window::height) * sensitivity
input.delta / static_cast<float>(windowHeight) * sensitivity
);
rotation.x -= d.x;
rotation.y -= d.y;
@@ -272,13 +272,15 @@ void PlayerController::update(float delta, const Input* inputEvents) {
updatePlayer(delta);
}
void PlayerController::postUpdate(float delta, const Input* input, bool pause) {
void PlayerController::postUpdate(
float delta, int windowHeight, const Input* input, bool pause
) {
if (!pause) {
updateFootsteps(delta);
}
if (!pause && input) {
camControl.updateMouse(this->input);
camControl.updateMouse(this->input, windowHeight);
}
camControl.refreshRotation();
player.postUpdate();