mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Controllers minor refactor
This commit is contained in:
parent
c0050cffaa
commit
856f5879f1
4 changed files with 28 additions and 22 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue