From 4bc5b54a2e0eb637e218d1ba1065a2feeb056adb Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Sat, 19 Jun 2021 15:25:20 +0200 Subject: [PATCH] Fixing gamepad controls --- sources/System/Gamepad/GamepadSystem.cpp | 4 +++- sources/System/Gamepad/GamepadSystem.hpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sources/System/Gamepad/GamepadSystem.cpp b/sources/System/Gamepad/GamepadSystem.cpp index f59f87dc..e28b389f 100644 --- a/sources/System/Gamepad/GamepadSystem.cpp +++ b/sources/System/Gamepad/GamepadSystem.cpp @@ -17,7 +17,7 @@ namespace BBM : System(wal) {} - void GamepadSystem::onFixedUpdate(WAL::ViewEntity &entity) + void GamepadSystem::onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds) { const auto &gamepadComponent = entity.get(); auto &controllable = entity.get(); @@ -34,6 +34,8 @@ namespace BBM for (auto key : keyPressedMap) key.second = controllable.fastClick ? gamepad.isDown(key.first) : gamepad.isPressed(key.first); + if (gamepad.isPressed(GAMEPAD_BUTTON_MIDDLE_LEFT) || gamepad.isPressed(GAMEPAD_BUTTON_MIDDLE_RIGHT)) + controllable.pause = true; controllable.move.x = gamepad.getAxisValue(gamepadComponent.LeftStickX) * -1; controllable.move.y = gamepad.getAxisValue(gamepadComponent.LeftStickY) * -1; controllable.move.x -= static_cast(gamepad.isDown(gamepadComponent.keyRight)); diff --git a/sources/System/Gamepad/GamepadSystem.hpp b/sources/System/Gamepad/GamepadSystem.hpp index 61efdd5e..187d1bbf 100644 --- a/sources/System/Gamepad/GamepadSystem.hpp +++ b/sources/System/Gamepad/GamepadSystem.hpp @@ -16,7 +16,7 @@ namespace BBM { public: //! @inherit - void onFixedUpdate(WAL::ViewEntity &entity) override; + void onUpdate(WAL::ViewEntity &entity, std::chrono::nanoseconds) override; //! @brief A default constructor explicit GamepadSystem(WAL::Wal &wal);