Controllers minor refactor

This commit is contained in:
MihailRis
2023-11-30 05:14:10 +03:00
parent c0050cffaa
commit 856f5879f1
4 changed files with 28 additions and 22 deletions
+19
View File
@@ -115,6 +115,25 @@ PlayerController::PlayerController(Level* level, const EngineSettings& settings)
camControl(level->player, settings.camera) {
}
void PlayerController::update(float delta, bool input, bool pause) {
if (!pause) {
if (input) {
updateKeyboard();
} else {
resetKeyboard();
}
updateCamera(delta, input);
updateControls(delta);
}
refreshCamera();
if (input) {
updateInteraction();
} else {
selectedBlockId = -1;
}
}
void PlayerController::updateKeyboard() {
input.moveForward = Events::active(BIND_MOVE_FORWARD);
input.moveBack = Events::active(BIND_MOVE_BACK);