From c3a0d1f48115b113fff8476baed640151987611a Mon Sep 17 00:00:00 2001 From: Kevin Poretti Date: Fri, 10 Nov 2023 14:27:55 -0500 Subject: [PATCH] Reset current input when losing focus of game viewport --- .../Input/FFPlayerController.cpp | 11 +++++++++++ .../Input/FFPlayerController.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/Source/UnrealFightingFramework/Input/FFPlayerController.cpp b/Source/UnrealFightingFramework/Input/FFPlayerController.cpp index 24a059b..2a3f8cd 100644 --- a/Source/UnrealFightingFramework/Input/FFPlayerController.cpp +++ b/Source/UnrealFightingFramework/Input/FFPlayerController.cpp @@ -56,6 +56,7 @@ void AFFPlayerController::AddCurrentInputToBuffer() //SendInputsToRemote(); } + bool AFFPlayerController::CheckInputSequence(const FFFInputSequence& InInputSequence) { return InputBuffer->CheckInputSequence(InInputSequence); @@ -80,6 +81,7 @@ bool AFFPlayerController::CheckInputSequences(const TArray& In return false; } + void AFFPlayerController::DisableMostRecentInput() { InputBuffer->DisableMostRecentInput(); @@ -101,3 +103,12 @@ void AFFPlayerController::SetupInputComponent() } } } + + +void AFFPlayerController::FlushPressedKeys() +{ + Super::FlushPressedKeys(); + + RawInput.Buttons = 0; + RawInput.MoveAxes = FVector2D::ZeroVector; +} diff --git a/Source/UnrealFightingFramework/Input/FFPlayerController.h b/Source/UnrealFightingFramework/Input/FFPlayerController.h index da47354..cdceb7d 100644 --- a/Source/UnrealFightingFramework/Input/FFPlayerController.h +++ b/Source/UnrealFightingFramework/Input/FFPlayerController.h @@ -75,6 +75,8 @@ public: // APlayerController interface virtual void SetupInputComponent() override; + + virtual void FlushPressedKeys() override; // End of APlayerController interface protected: